SQL 2005...
We are trying to run a query to Identify a duplicate web reservation ID and the related fields in that row if there are any. I came up with this query
SELECT WRESID,
COUNT(WRESID) AS NumOccurrences
FROM res2sql.dbo.Reservations
Where serviceType = 1 AND Operation = 'N'
GROUP BY WRESID
HAVING ( COUNT(WRESID) > 1 )
which returns a list of the duplicate WRESID and the count of 2 so the query is finding the duplicates. What I need is to have it also include the PickupTOD and ReservationTOD field. If I try to add those in Select WRESID,PICKUPTOD,RESERVATIONTOD I get a Syntax error. "Msg 102, Level 15, State 1, Line 2
Incorrect syntax near 'WRESID'".
Any help you can provide is greatly appreciated.
AZ874750,2
AZ1003193,2
AZ1026632,2
AZ1013481,2
AZ090324,2
AZ932285,2
AZ777151,2
AZ742403,2
AZ1007269,2
AZ1202571,2
AZ1202860,2
AZ251231,2
AZ1085117,2
AZ762948,2
We are trying to run a query to Identify a duplicate web reservation ID and the related fields in that row if there are any. I came up with this query
SELECT WRESID,
COUNT(WRESID) AS NumOccurrences
FROM res2sql.dbo.Reservations
Where serviceType = 1 AND Operation = 'N'
GROUP BY WRESID
HAVING ( COUNT(WRESID) > 1 )
which returns a list of the duplicate WRESID and the count of 2 so the query is finding the duplicates. What I need is to have it also include the PickupTOD and ReservationTOD field. If I try to add those in Select WRESID,PICKUPTOD,RESERVATIONTOD I get a Syntax error. "Msg 102, Level 15, State 1, Line 2
Incorrect syntax near 'WRESID'".
Any help you can provide is greatly appreciated.
AZ874750,2
AZ1003193,2
AZ1026632,2
AZ1013481,2
AZ090324,2
AZ932285,2
AZ777151,2
AZ742403,2
AZ1007269,2
AZ1202571,2
AZ1202860,2
AZ251231,2
AZ1085117,2
AZ762948,2