Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SPT Syntax to Get Correct Records
Message
 
 
To
17/09/2010 18:19:12
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01481691
Message ID:
01481696
Views:
46
This message has been marked as the solution to the initial question of the thread.
>Source data is an iSeries(AS400) machine
>
>I have one table that holds master header data and a child table that holds child records. My problem is when I chile record is flaged as deleted the record nolonger shows up in my join SPT list. Here is my sql:
>
>The deleteflag is a field of the webprddt7.qartdisps table.
>
>
>
>testconnString = "Select webprddt7.qartmast.recseq, docno, partno, rtqty, srcdef, DATE(idate) As datei," +;
>" webprddt7.qartmast.defects, webprddt7.qartdisps.disptype, webprddt7.qartdisps.rejsource," +;
>" webprddt7.qartdisps.dispqty, webprddt7.qartdisps.location, webprddt7.qartdisps.recseq," +;
>"  webprddt7.qartdisps.dispcmnts, locindex, splitmo, sourceflag, vstockflag, purgepflag, disploc," +;
>" localarw, dispwctr,webprddt7.qartdisps.buyerno, partname, corflag, caflag,webprddt7.qartdisps.vendorcode," +;
>" webprddt7.qartdisps.vendorname, rmarflag From webprddt7.qartmast" +;
>" Join webprddt7.qartsrcdef On webprddt7.qartsrcdef.recseq = webprddt7.qartmast.sourceflag" +;
>" Left Join webprddt7.qartdisps On webprddt7.qartdisps.rtindex = webprddt7.qartmast.recseq" +;
>" Left Join webprddt7.qartsubsrc On webprddt7.qartsubsrc.rtindex = webprddt7.qartmast.recseq" +;
>" Where webprddt7.qartmast.recseq = 767899 And (deleteflag = 0 Or deleteflag is NULL)"
>
>
Take a look at this blog post explaining your problem

http://beyondrelational.com/blogs/naomi/archive/2010/03/22/why-left-join-doesn-t-bring-all-records-from-the-left-table.aspx

The solution is to move the DeleteFlag condition to the JOIN condition.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform