Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Delete duplicates from tables

$
0
0

Hi,

I have Tables USERS_Pdt with data coulmns -  Product, UserID, Email, Gender, City, State, .... and Tables USER  with data coulmns -  UserID, Email, Gender, City, State, .... with Unique Non Clustered indexes in UserID and Email.

I have situation like below:

The required result is if the new userID is having the blank email then it will put "unknown " as value in email else  email itself. Now the situation is for the same UserID , I got two records for different products. Below is the required result:

User_IDEmailGenderStateCity
UHN50J72camps@gmail.comMCAFontana
ACT29F98fiminy@gmial.comFNJRoselle
QRY76VGQRY76VGMNYQueens

Any help is appreciated.

Thanks,

Rajneet



Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>