Wednesday, March 25, 2015

Get data changes from history table


SELECT ProductID
FROM Table
GROUP BY ProductID
HAVING COUNT(DISTINCT SalesPerson) > 1

If you want other details also use



SELECT *
FROM Table t
WHERE EXISTS
(
SELECT 1
FROM Table
WHERE ProductID = t.ProductID
GROUP BY ProductID
HAVING COUNT(DISTINCT SalesPerson) > 1
)





Please Mark This As Answer if it solved your issue

Please Vote This As Helpful if it helps to solve your issue

Visakh

----------------------------

My Wiki User Page

My MSDN Page

My Personal Blog

My Facebook Page


No comments:

Post a Comment