Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best SQL statement
Message
From
09/09/2007 04:10:21
 
 
To
09/09/2007 02:01:06
Reza Meamar
Homa Programming Group
Shiraz, Iran
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
Miscellaneous
Thread ID:
01253272
Message ID:
01253277
Views:
20
Hi,
Try
SELECT fldtrue, SUM(fldsum) FROM table GROUP BY fldcode,fldtrue WHERE fldtrue;
UNION ;
SELECT .F.,SUM(fldsum) FROM table WHERE !fldtrue
>I have a table with below record:
>
>FldCode   FldTrue   FldSum
>  21         T      10000
>  21         T      20000
>  22         T      30000
>  23         F      40000
>  24         F      50000
>
>I want to write a SQL statment that return below result:
>
>FldCode   FldTrue   FldSum
>             T      30000
>             T      30000
>             F      90000
>
>( I want Sum of similar FldCode and so Sum of records that FldTrue = .F. )
>
>Thanks
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform