Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to subquery in VFP 8
Message
From
05/09/2005 17:57:19
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01046845
Message ID:
01046853
Views:
18
>Try
SELECT room, MAX(res_date) AS max_date ;
>	FROM mycurs1 ;
>	GROUP BY 1 ;
>	INTO CURSOR crsMaxRes
>*
>SELECT * FROM mycurs1 ;
>	WHERE room + res_date IN ( ;
>		SELECT room + max_date ;
>			FROM crsMaxRes )
>* or
>SELECT mc1.* FROM mycurs1 mc1 ;
>	JOIN crsMaxRes mr ON mr.room = mc1.room ;
>	AND mr.max_date = mc1.res_date
>
>
>

Sergey,

Thank you for your help. I will try what you are suggesting.
I also need to add PK_VALUE column to the resulting cursor and hopefully it won't break the GROUP BY of the SQL Select.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform