How to list contents of HEATCAI where the CustID is duplicated.

Version 1

    Details

     

    How to list contents of HEATCAI where the CustID is duplicated.


    This can be handy if needing to know what CustID is allowing more than one LoginID in HEAT Self Service.

     


    Resolution

     

    Run the following SQL statement in SQL Management Studio and it will return a list of rows for all CustID's that are being used more than once.



    SELECT     a.*

    FROM        HEATCAI a INNER JOIN

                             (SELECT     CustID

                                FROM          HEATCAI

                                GROUP BY CustID

                                HAVING      COUNT(*) > 1) b ON b.CustID = a.CustID