Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query Problem
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
01218545
Message ID:
01218948
Views:
15
It doesn't like JOIN with a SELECT. It's VFP9 SQL language improvements.

>I am trying to compile this in VFP 7, and it's failing. I'm guessing it doesn't
>like the DISTINCT. How can I do this in 7?
>
>
>SELECT SysRecord, ResNam, EffDate, AvailDay, EquivDay, EquivWeek, EquivMnth;
>    FROM ResAvail ra;
>    JOIN (SELECT DISTINCT ResNam FROM SQLGenData) sgd ON sgd.ResNam = ra.ResNam;
>    INTO CURSOR Resultsa
>
>
>Thanks
>
>
>
>
>
>>
>>SELECT SysRecord, ResNam, EffDate, AvailDay, EquivDay, EquivWeek, EquivMnth
>>	FROM ResAvail ra
>>	JOIN (SELECT DISTINCT ResNam FROM SQLGenData) rn ON rn.ResNam = ra.ResNam
>>	INTO CURSOR Results
>>
>>>The table SQLGenData has 77000 records in it. The ResNam column is NOT unique.
>>>The ResAvail table however DOES have a unique ResNam column.
>>>
>>>I want to pull all ResAvail records for the SQLGenData records. There should be only
>>>one result record for each distinct ResNam.
>>>
>>>Is it possible to do this in a JOIN?
>>>
>>>
>>>SELECT SysRecord, ResNam, EffDate, AvailDay, EquivDay, EquivWeek, EquivMnth ;
>>>	FROM ResAvail;
>>>	WHERE ResNam IN;
>>>		(SELECT DISTINCT ResNam;
>>>			FROM SQLGenData);
>>>	INTO CURSOR Results
>>>			
>>>
>>>
>>>
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform