Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Should SQL statement be one or more
Message
From
04/05/2005 15:14:45
 
 
To
04/05/2005 14:32:19
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows 2000 SP4
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01010960
Message ID:
01010986
Views:
29
This message has been marked as a message which has helped to the initial question of the thread.
Multiple queries may be faster. See http://www.craigberntson.com/Articles/kb004.htm


>I have a select statement as such:
>
>SELECT CLIENTNM.DISTRICT, ADDRES.STATE, ALIASES.NAME_ALIAS, ;
>  CLNTREF.REF_COD, CR_HIST.VDATE, CUSTOMER.CR_RATING, PRODUCTS.DEDNT ;
> FROM CLIENTNM, ADDRES, ALIASES, CLNTREF, CR_HIST, CUSTOMER, PRODUCTS, ;
>    CONTACT ;
>  WHERE CLIENTNM.IDCLIENT = ADDRES.IDCLIENT AND ;
>    ADDRES.ADDRESS_TY = "MN" AND ;
>    CLIENTNM.IDCLIENT = ALIASES.IDCLIENT AND ;
>    ALIASES.ALIAS_TYPE = "MAIN" AND ;
>    CLIENTNM.IDCLIENT = CUSTOMER.IDCLIENT AND ;
>    CLIENTNM.IDCLIENT = PRODUCTS.IDCLIENT AND ;
>    CLIENTNM.IDCLIENT = CR_HIST.IDCLIENT AND ;
>    CLIENTNM.IDCLIENT = CONTACT.IDCLIENT AND ;
>    CLIENTNM.IDCLIENT = CLNTREF.IDCLIENT AND ;
>    CONTACT.CONTACT_ID = CLNTREF.CONTACT_ID ;
>  ORDER BY 1 DESC ;
>  INTO TABLE CLNTSHAWNA.DBF
>
>but the result table brings up multiple instances of any client where there are 2 or more records in cr_hist and/or clntref. I want the latest date for the cr_hist.vdate for each client and just one record from the clntref for the client.
>
>Would it be easier to do several select statements to get this infor, or can someone show me the way to do it for one select statement.
>
>Thanks in Advance.
>Beth
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Reply
Map
View

Click here to load this message in the networking platform