Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Complex accounting report for 'As of' date
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01375665
Message ID:
01376191
Views:
15
>Hi Naomi
>
>Firstly congratulations for the award this year too and I see you have it all 3 categories, you earned it. Thanks for the help you have given me too.
>
>>SELECT COUNT(distinct myField) as iAccounts, ;
>>SUM(IIF(ISNULL(dPosting_Date) AND iClosed = 1,1,0)) as iClosedNoPayments, ;
>>SUM(IIF(ISNULL(dPosting_Date) AND iClosed = 1,0,1)) as iClosedWithPayments, ;
>>SUM(IIF(ISNULL(dPosting_Date) AND iClosed = 0,1,0)) as iOpenNoPayments, ;
>>SUM(IIF(ISNULL(dPosting_Date) AND iClosed = 0,0,1)) as iOpenWithPayments,
>
>I know you have this resolved so that is great, but I can't resist the comment, you are only SUM()ming NULLs above, how about the non-NULL records and could a GROUP BY on account help you with the query.

Thanks again. A bit tired today, but I could not figure out how to properly sum accounts and not payments. If you group by Account Number, would it still work? I guess it would, don't know why I didn't try when I was looking at this statement today...
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform