Begging your patience, I'm wondering if someone can help me with a beginner question. I am trying to write a query against our trouble ticket DB. I want to find tickets that have multiple tech assignments associated with a single ticket. How can write a query that says if in the CALLID field you find the same value more than once, return those rows and only those rows?
SELECT *.p, CallCount.s
FROM TicketTable p
RIGHT OUTER JOIN (
SELECT CallId, Count(CallId) AS CallCount
FROM TicketTable
GROUP BY CallId
WHERE CallCount > 1
) s
Sorry, the code had to be corrected...
I was in a rush
Code:
SELECT p.*, s.CallCount
FROM TicketTable p
RIGHT OUTER JOIN (
SELECT CallId, Count(CallId) AS CallCount
FROM TicketTable
GROUP BY CallId
WHERE CallCount > 1
) s ON p.CallId = s.CallId