Your technology certification is waiting. Enroll in Cloud Class ®
FROM (( SELECT ItemID,
COUNT(* ) AS CountPerCashier,
MAX(lp) AS Max_lp
GROUP BY ItemID,
HAVING COUNT(* ) > 1) AS t1
INNER JOIN ( SELECT lp,
COUNT(* ) AS CountPerAllCashiers
GROUP BY lp) AS t2
ON t1.Max_lp = t2.lp)
Open in new window
This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.
WHERE (((t2.ItemId) IN ( SELECT [ItemId]
FROM [t2] AS Tmp
GROUP BY [ItemId]
HAVING COUNT(* ) > 1)))
GROUP BY t2.ItemId,
ORDER BY t2.ItemId;
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.