Hi all,
I have the following sql statement in a query:
the problem is it gives each account the same DiscountGroupID and the same RebateGroupID for all customers.
I am not sure how to write in the where clause to look at the DiscountGroupID and the RebateGroupID for that particular account.
I know it is something like the following :
But I don`t know how to add this to the sql statement or in the query designer.
Any help is much appreciated
Thanks
Gazza
I have the following sql statement in a query:
Code:
SELECT TblCustomers.Account, TblProducts.BinNo, "" AS ColumnC, "" AS ColumnD, [Listprice]-([ListPrice]*[Discount])-[Monetary] AS NettPrice
FROM ((TblSalesGroup INNER JOIN TblDiscountGroup ON TblSalesGroup.[SalesGroupID] = TblDiscountGroup.[SalesGroupID]) INNER JOIN TblCustomers ON TblDiscountGroup.[DiscountGroupID] = TblCustomers.[DiscountGroupID]) INNER JOIN TblProducts ON TblSalesGroup.SalesGroupID = TblProducts.SalesGroupID
WHERE (((TblCustomers.DiscountGroupID)>1) AND ((TblCustomers.RebateGroupID)>1));
the problem is it gives each account the same DiscountGroupID and the same RebateGroupID for all customers.
I am not sure how to write in the where clause to look at the DiscountGroupID and the RebateGroupID for that particular account.
I know it is something like the following :
Code:
Dlookup("DiscountGroupID","TblCustomers","Account=" & "'" & "Account" & "'")
But I don`t know how to add this to the sql statement or in the query designer.
Any help is much appreciated
Thanks
Gazza