Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to find nearest date in select sql
Message
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01186568
Message ID:
01186575
Views:
29
nearest as a first date,

i have a sql query for sales report,

eg simple
local ldfirst,ldend,lcfishcode1,lcfischcode2

ldfirst=thisform.txtd1.value
ldend=thisform.txtd2.value
lcfischcode1=[001] && sales fische type
lcfischcode2=[002] && sales fische type

select sum(quantity)*sum(price)/sum(quantity) as navgpriceS where fischetype= m.lcfishcode1 and ;
between(ldate,m.ldfirst,m.ldend) into cursor CrsSales

select sum(quantity)*sum(price)/sum(quantity) as navgpriceB where fischetype= m.lcfishcode2 and ;
between(ldate,m.ldfirst,m.ldend) into cursor CrsBuyings
and then i am joining above cursors with one cursor via left join,
here is my need sometimes may be there is no buyings between which is given dates at this moment
i want to use nearest buying price instead of navgpriceB at 3rd SQL

hope that i've explain :)

TIA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform