I am working with a table that contains Account_No as unique ID, Customer_Name, Building_Name. The table below is an example:
It can be seen for few cases there are same customer name and same building however different Account_No. I need to remove duplicate names even though they have unique Account_No. Building_Name and Customer_Name are ties together. For example “William—-Science City” and “William—–River Club” should be count as two customers since they are residing in different buildings. The result table should look as below;
I need to use SQL for creating the resulting table. Kindly use Customer Table as the reference for SQL query. Thanks
Advertisement
Answer
Select Min(Account_No) As Account_No ,Customer_Name,Building_Name From Customer_Table Group By Customer_Name, Building_Name