Sephiroth0327
Registered User.
- Local time
- Today, 12:01
- Joined
- Aug 18, 2009
- Messages
- 19
I have a basic Revenue table with some basic fields. One of these fields in USD_REV_AMOUNT which is associated with a PROJECT_NUMBER. In the Revenue table, I have multiple entries for the same project number and I have a query which subtotals all the USD_REV_AMOUNT for each PROJECT_NUMBER. Pretty simple.
There is a third column in the Revenue table called REVENUE_PROCESSED which is a simple Yes/No column. I want to update my query so that it continues subtotaling by PROJECT_NUMBER but breaks it out by REVENUE_PROCESSED.
Here is the output I am currently seeing (removed extra fields which are unimportant):
PROJECT_NUMBER SumOfUSD_REV_AMOUNT REVENUE_PROCESSED
123456 $100000.00 Null
Problem is that when I look at the Revenue table directly, there may be 20 entries for the same project, each with either a "Y" or "N" for REVENUE_PROCESSED but it's coming up as Null in the query (actually it appears blank but I am referencing Null to make it clear here).
What I want to see is
PROJECT_NUMBER SumOfUSD_REV_AMOUNT REVENUE_PROCESSED
123456 $70000.00 Y
123456 $30000.00 N
Here is my SQL where I attempted to achieve this, but it is still not working:
Any suggestions? I'm sure I am missing something simple.
There is a third column in the Revenue table called REVENUE_PROCESSED which is a simple Yes/No column. I want to update my query so that it continues subtotaling by PROJECT_NUMBER but breaks it out by REVENUE_PROCESSED.
Here is the output I am currently seeing (removed extra fields which are unimportant):
PROJECT_NUMBER SumOfUSD_REV_AMOUNT REVENUE_PROCESSED
123456 $100000.00 Null
Problem is that when I look at the Revenue table directly, there may be 20 entries for the same project, each with either a "Y" or "N" for REVENUE_PROCESSED but it's coming up as Null in the query (actually it appears blank but I am referencing Null to make it clear here).
What I want to see is
PROJECT_NUMBER SumOfUSD_REV_AMOUNT REVENUE_PROCESSED
123456 $70000.00 Y
123456 $30000.00 N
Here is my SQL where I attempted to achieve this, but it is still not working:
Code:
SELECT Revenue.PROJECT_NUMBER, Sum(Revenue.USD_REV_AMOUNT) AS SumOfUSD_REV_AMOUNT, Revenue.REVENUE_PROCESSED
FROM Revenue
GROUP BY Revenue.PROJECT_NUMBER, Revenue.REVENUE_PROCESSED
ORDER BY Sum(Revenue.USD_REV_AMOUNT) DESC;
Any suggestions? I'm sure I am missing something simple.