Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to find nearest date in select sql
Message
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01186568
Message ID:
01186575
Vues:
36
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform