Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL FROM SQL
Message
From
21/01/2009 13:07:25
 
 
To
21/01/2009 08:41:37
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
01375790
Message ID:
01375955
Views:
17
>>>Somehow, I need to get this from the SQL below. In one SQL if possible. RecNo does not work well in JOINs, etc, but I'm thinking if I can make the 1st one select from the 2nd one, it might work. I don't know though; the more I look at it, the more it looks like crap.
>>>
>>>CarName     Seq     Rec
>>>
>>>
>>>SELECT InsCarr.CarName FROM InsCarr JOIN Covr ON InsCarr.InsCarr=Covr.cvCarr ;
>>>WHERE Covr.Pat_No=Patient.PtPn AND CvPS=InsuranceLevel AND ! DELETED() ;
>>>ORDER BY 1 INTO CURSOR CarrierList
>>>
>>>SELECT PADL( Seq_Num, 4, '0' ) AS Seq, RECNO() AS Rec FROM covr WITH (BUFFERING=.T.) ;
>>>WHERE Pat_No=Patient.PtPn AND CvPS=InsuranceLevel AND ! DELETED() ;
>>>ORDER BY 1 INTO CURSOR SequenceList
>>>
>>
>>Something like this?
>>
>>
>>SELECT InsCarr.CarName, Seq, Rec FROM InsCarr JOIN (SELECT PADL( Seq_Num, 4, '0' ) AS Seq, RECNO() AS Rec FROM covr WITH (BUFFERING=.T.) ;
>>WHERE Pat_No=Patient.PtPn AND CvPS=InsuranceLevel AND ! DELETED() ) ;
>>Covr ON InsCarr.InsCarr=Covr.cvCarr ;
>>ORDER BY 1 INTO CURSOR CarrierList
>
>I had to just add cvCarr to the inner SQL, but that worked. I don't fully understand it, but it worked. Thanks!

you can't use DELETED(), RECNO() ... in joined SQL
Previous
Reply
Map
View

Click here to load this message in the networking platform