Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need Assistance With A Query
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01035195
Message ID:
01035222
Views:
16
Perfect! Thanks!


>Try
SELECT ;
>		UserId, ;
>		COUNT(*) AS NumSpots, ;
>		COUNT(DIST invoiceid) AS Invoices, ;		
>		SUM(Gross) AS TotalGross, ;
>		SUM( IIF(Status = 'D', 1, 0)) AS Discrep, ;
>		SUM( IIF(Status = 'R', 1, 0)) AS Reconciled ;
>	FROM Commits ;	
>	GROUP BY 1
>
>
>
>>I need to pull invoice records from a table called 'Commits'.
>>I need to following data, rolled up by column UserId:
>>
>>
>>UserId       - Id of the user who created the record
>>NumSpots     - Equal to the # records retreived for the user
>># Invoices   - Would be the same as 'select disticnt invoiceid where userid =...'
>>Total Gross  - SUM of the Gross column, by user
>>Discrep      - Total number of records with Status = 'D', by user
>>Reconciled   - Total number of records with Status = 'R', by user
>>
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform