Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SPT Statement
Message
 
 
To
04/11/2008 16:00:35
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP1
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01359628
Message ID:
01359686
Views:
27
>Please next time format your code. It is hard to read and understand (at least for me)
>Also why not use TEXT ENDTEXT block when you build such statements. It will be easier for you also:
>
>TEXT TO testString NOSHOW TEXTMERGE PRETEXT 15
>  with SelCTE as ( Select recseq, CASE WHEN faistatus = 1
>                              THEN 'Accepted'
>                         WHEN faistatus = 2
>                              THEN 'Rejected'
>                    ELSE 'SEE ORIGINAL FAI' END As fais,
>            inspectord, dwgrev
>     FROM webprddt6.drawmfai mt1
>     INNER JOIN (SELECT webprddt6.drawmfai.partno, MAX(webprddt6.drawmfai.inspectord) AS MaxDate
>                    FROM webprddt6.drawmfai
>                 GROUP BY webprddt6.drawmfai.partno,
>                          webprddt6.drawmfai.vendorcode ) mt3
>            ON mt3.partno = mt1.partno AND mt3.MaxDate = mt1.inspectord
>      WHERE (mt1.partno = '116405-015' Or mt1.partno = '116405-015') And Left(mt1.vendorcode,5) = 'G7135')

     select MaxDate, inspectord, dwgrev, cast(sum(case when Fais = 'Accepted' then 100000 else 1 end) as int) as Check from SelCTE group by MaxDate, inspectord, dwgrev having mod(sum(case when Fais = 'Accepted' then 100000 else 1 end))/100000 between 1 and 2 inner join (select * from SelCTE where Fais = 'Accepted')) Multiple on SelCTE.MaxDate = Multiple.MaxDate and ...
     UNION 
...
That's the idea, basically.



>ENDTEXT
>
>
>I have questions here. Is inspectord is datetime?
>And if it is datetime what you store there? Only date part of full datetime?
>Also what you want as a result for these two situations:
>
>1. The record is first rejected and after that accepted?
>2. The record is first accepted and after that rejected?
>
>
>O, BTW is this a typo here:
>mt1.partno = '116405-015' Or mt1.partno = '116405-015'
>Both partnos are equal, then why you need OR?
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