Ok EE...this could be another /facepalm moment for me, but I've been wracking my brain so now it's your turn.
I have two tables, as follows
Essentially, headers is the detail like customerID, sales rep, order date and total, and Items is the line detail.
I'm trying to run a query for management that will tell them :
1) Date of Order, 2) Order Total, 3) Purchase Vehicle, 4) number of line items
I have the following query that in theory would give me just that:
select H.DocDate, H.GrandTotal, H.CustomText03, count(I.DocID) as Lines
From DocumentHeaders as H, DocumentItems as I
JOIN DocumentItems on DocumentHeaders.ID = DocumentItems.DocID
where H.CustomText05 = 'UDA00120493523' and
DocType = 'Order' and
DocStatus = 'Open' or DocStatus = 'Exported'
Unfortunately I get the following error: "The multi-part identifier "DocumentHeaders.ID" could not be bound."
I've spent a few hours re-working this seemingly simple query and scouring the webs...I leave it to you to show me the error of my ways.