I've used report writers in the past (Crystal Reports), but am new to doing straight SQL data queries.
I have 3 tables:
Sales Line (L).
The table joins are:
[C.Account = S.CustAccount],
[S.OrderID = L.OrderID]
I want to report on 4 columns:
Expression1 = (Sum of L.Amount Grouped by C.Account).
Expression2 = (C.CreditLimit - Expression1)
Not all Customer records have Sales records. I want to include customers even if no sales records.
I only want to include Sales records where S.OrderType = "3"
I was ok with a left outer join between Customer and SalesHeader tables, until I added the selection criteria for "S.OrderType = 3". Then it defaulted to inner join logic and all my customers with no salesheader records disappeared.
My "assumed" solution:
When I've used report writers in the past I would do a sub report, which I assume acts like a sub query.
My idea is that a sub query can function like a LOJ with conditions, so I would do a sub query for Expression1 and Expression2.
How do I include a multi table join in the sub query statement?
Is the sub query in the SELECT, FROM, WHERE section of the statement?
It was supposed to be JUST a simple little project!
Any enlightenment out there? I'm feeling pretty dim...