Microsoft
Software
Hardware
Network
Question : Union Query duplicates
SQL Server 2008
I have a union query of names and email addresses.
There is also a column of MemberType
On one side of the union the Membertype is 1 on the other side, it is 2.
The results will contain duplicate email addresses.
I need to alter the query so that if a duplicate email exists then we choose the MemberType of 1 before we choose the MemberType of 2, thus ignoring MemberType 2 if a MemberType 1 exists.
Thanks
Answer : Union Query duplicates
SELECT name, MIN(MemberType) MemberType
FROM
(
SELECT name, MemberType FROM tbl1
UNION ALL
SELECT name, MemberType FROM tbl2
) t
GROUP BY name ;
Random Solutions
Need SQL Syntax help to make my qry more efficient.
Windows 7 Screen Saver won't start
How do I get MsAccess to include commas as part of the text and not a delimiter when exportig with GetString?
I am trying to get the "Currently" selected item in a multiple selection listbox - how can this be done?
DevExpress XtraTreeList - tree structure
Setup POP3 on Exchange 2007 / SBS 2008 Server
Simple T-SQL question...
Sharepoint Backup
Why wont a hp laptop power up?
Transfer data from Access to Excel