Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL suggestions needed
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00331812
Message ID:
00331909
Views:
15
>Hi Nick,
>>
>>I would suggest to break this SQL down to several SQLs and see where exactly you stop getting the data. Then you may try to combine it back again (or not).
>>
>>Nick
>
>
>This is my test:
>
>
>SELECT * FROM tranmstr ;
>left JOIN misclndr on tranmstr.tranid = misclndr.tranid ;
>inner JOIN propmstr on tranmstr.propid = propmstr.propid ;
>inner JOIN sitemstr on tranmstr.propid = sitemstr.propid  and sitemstr.town="GOSN";
>left JOIN bldgmstr on tranmstr.propid = bldgmstr.propid ;
>where (prefcode = "P"  and SOURCE="S") ;
>and between(extrYear+extrWeek ,'200004', '200004') ;
>into cursor tttt
>
>
>** The first SQL produced 0 records (there is no transactions for this town)
>
>select * from tttt right join towns on tttt.town_a=towns.town where towns.town='GOSN'
>
>** The second SQL produced one record (as I desire) with NULL in all tttt fields and Towns fields for this town.
>
>
>So, now is the question: how can I combine this 2 SQLs into one and get the same result? Is it possible without joing with Towns table? (I don't need an extra information from Towns)
>
>Thanks in advance.

So, if it produces the result you need, why not just leave it as 2 SQLs?
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform