MackMan
Registered User.
- Local time
- Today, 15:51
- Joined
- Nov 25, 2014
- Messages
- 174
Hello All. I once again seek your knowledge... This time with SQL (Honestly, not one of my strong points, but getting there)
I have two tables, joined together with a Union query, and what I'd like out of it is a Sum of Categories & Sub Categories, based on all days this year.
When run on their own, they give me exactly what I need, but when used with UNION ALL, I have duplicate "Sub Category" Entries...
One from one side of the query, and one from the other...
Is there anyway this can be put on just the one line?
the SQL I'm using is this...
As always, Super thanks for your help.
I have two tables, joined together with a Union query, and what I'd like out of it is a Sum of Categories & Sub Categories, based on all days this year.
When run on their own, they give me exactly what I need, but when used with UNION ALL, I have duplicate "Sub Category" Entries...
One from one side of the query, and one from the other...
Is there anyway this can be put on just the one line?
the SQL I'm using is this...
As I said, SQL isn't my thing, but every stone unturned is another feather and all that...SELECT tblTopLines.Category, tblTopLines.SubCategory, Sum(tblTopLines.Credit) AS SumOfCredit, Sum(tblTopLines.Debit) AS SumOfDebit
FROM tblTopLines
WHERE (((tblTopLines.TransDate) Between #1/1/2015# And #12/31/2015#))
GROUP BY tblTopLines.Category, tblTopLines.SubCategory
HAVING (((tblTopLines.Category)="Car"))
UNION ALL
SELECT tblSplits.Category, tblSplits.SubCategory, Sum(tblSplits.Credit) AS SumOfCredit, Sum(tblSplits.Debit) AS SumOfDebit
FROM tblSplits
WHERE (((tblSplits.TransDate) Between #1/1/2015# And #12/31/2015#))
GROUP BY tblSplits.Category, tblSplits.SubCategory
HAVING (((tblSplits.Category)="Car"));
As always, Super thanks for your help.