checkmofoshoduno
asked on
How to run the following query in MS Access?
How do i run this in How to run the following Query in Microsoft Access??
SELECT V_CODE,
COUNT(DISTINCT (P_CODE))
FROM PRODUCT
GROUP BY V_CODE
HAVING COUNT(DISTINCT (P_CODE)) > 2;
SELECT V_CODE,
COUNT(DISTINCT (P_CODE))
FROM PRODUCT
GROUP BY V_CODE
HAVING COUNT(DISTINCT (P_CODE)) > 2;
ASKER
ASKER
Attached Access DB
Ch07-E4.mdb
Ch07-E4.mdb
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Kudos
ASKER
thank you.
Small tweak to Peter's:
For more about distinct counts in Access:
https://www.experts-exchange.com/Microsoft/Development/MS_Access/A_2417-Calculating-Distinct-Counts-in-Access.html
Select q1.V_code, count(q1.P_Code) as PCount from
(Select distinct V_code, P_code from Product) as q1
Group By q1.V_code
HAVING count(q1.P_Code) > 2
For more about distinct counts in Access:
https://www.experts-exchange.com/Microsoft/Development/MS_Access/A_2417-Calculating-Distinct-Counts-in-Access.html
too slow :)
WHere did the last line of your query appear from ? Did you edit the Q after you posted it?
Select V_code, count(P_Code) as PCount from
(Select distinct V_code, P_code from Product) as q1
Group By V_code
Having count(P_Code) >2
Select V_code, count(P_Code) as PCount from
(Select distinct V_code, P_code from Product) as q1
Group By V_code
Having count(P_Code) >2
(Select distinct V_code, P_code from Product) as q1
Group By V_code