Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Get Desired Result from SPT
Message
 
To
18/12/2008 10:56:58
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:
01368541
Message ID:
01368547
Views:
8
>I am haveing trouble with this SPT. It excludes any records that have a value in the recseq field that does not match my recseq criteria.
>
>
>testconnString = "Select recseq, descptncd," +;
>	" CASE WHEN status Is NULL THEN 0 Else status END As status," +;
>	" CASE WHEN cmnt Is NULL THEN '' Else cmnt END As cmnt, clcode From webprddt6.drawmextc1" +;
>	" Left Join webprddt6.drawmextc3 On webprddt6.drawmextc3.codeid = webprddt6.drawmextc1.clcode" +;
>	" Where (recseq = 52632 Or recseq is NULL) Order By clcode"
>
>
>
>First the webprddt6.drawmextc3 table contains no records with a recseq = 52632. However it does contain 4 records with recseq = 69607.
>
>Secnd my desired result is this should return 70 records which is the count of webprddt6.drawmextc1. It however only returs 66 records, excluding the 4 records already existing in the table. How do change the Where filter to include records that might have a different recseq?
TEXT TO testconnString NOSHOW
     Select recseq,
            descptncd,
            ISNULL(Status, 0) AS Status, 
            ISNULL(cmnt, '')  AS cmnt,
            clcode
     From webprddt6.drawmextc1
     Left Join webprddt6.drawmextc3 On webprddt6.drawmextc3.codeid = webprddt6.drawmextc1.clcode
     Where ISNULL(recseq,52632) = 52632
     Order By clcode
ENDTEXT
That should (and that is your SELECT) give you ALL records where RecSeq is NULL or RecSeq = 52632.
Test it first in SSMS.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform