S
Support
I have a database with 3 tables linked - Customers - Orderslines - Orders.
I want to run a query on those that bought from dept menswear/ accessories
and footwear so I have created the below query:
SELECT DISTINCT tblCustomers_2SV.UserID, tblCustomers_2SV.Salutation,
tblCustomers_2SV.[First Name], tblCustomers_2SV.[Last Name],
tblCustomers_2SV.[Billing Address Line 1], tblCustomers_2SV.[Billing Address
Line 2], tblCustomers_2SV.[Billing Address Line 3],
tblCustomers_2SV.[Billing Post Code], tblOrderlines_2.Dept,
tblCustomers_2SV.[Receive In-House Direct Marketing]
FROM (tblCustomers_2SV INNER JOIN tblOrders_2SV ON
tblCustomers_2SV.UserID=tblOrders_2SV.UserID) INNER JOIN tblOrderlines_2 ON
tblOrders_2SV.[Order Num]=tblOrderlines_2.[Order Num]
WHERE (((tblOrderlines_2.Dept)="footwear" Or
(tblOrderlines_2.Dept)="menswear" Or (tblOrderlines_2.Dept)="accessories")
AND ((tblCustomers_2SV.[Receive In-House Direct Marketing])="yes"));
This almost gives me the result I want however I am getting duplicate
entries for customers who bought items from more than one queried dept. How
would I rectfy this so I can get one result for the customer?
thanks
I want to run a query on those that bought from dept menswear/ accessories
and footwear so I have created the below query:
SELECT DISTINCT tblCustomers_2SV.UserID, tblCustomers_2SV.Salutation,
tblCustomers_2SV.[First Name], tblCustomers_2SV.[Last Name],
tblCustomers_2SV.[Billing Address Line 1], tblCustomers_2SV.[Billing Address
Line 2], tblCustomers_2SV.[Billing Address Line 3],
tblCustomers_2SV.[Billing Post Code], tblOrderlines_2.Dept,
tblCustomers_2SV.[Receive In-House Direct Marketing]
FROM (tblCustomers_2SV INNER JOIN tblOrders_2SV ON
tblCustomers_2SV.UserID=tblOrders_2SV.UserID) INNER JOIN tblOrderlines_2 ON
tblOrders_2SV.[Order Num]=tblOrderlines_2.[Order Num]
WHERE (((tblOrderlines_2.Dept)="footwear" Or
(tblOrderlines_2.Dept)="menswear" Or (tblOrderlines_2.Dept)="accessories")
AND ((tblCustomers_2SV.[Receive In-House Direct Marketing])="yes"));
This almost gives me the result I want however I am getting duplicate
entries for customers who bought items from more than one queried dept. How
would I rectfy this so I can get one result for the customer?
thanks