Microsoft
Software
Hardware
Network
Question : Select distinct based on 2 fields
I have a table, Buyer. It has BuyerCode and Country columns. I want to select distinct based on 2 columns combined. For example, I have 1st record: Buyer1, USA, 2nd record: Buyer1, Canada, record 3: Buyer2, USA etc. I want to select both Buyer1 since its country is different. If I do Select Distinct BuyerCode, I only get Buyer1 with USA. How do I do it?
I appreciate your suggestions in advance. Thank you.
Answer : Select distinct based on 2 fields
SELECT BuyerCode, Country
FROM Buyer
GROUP BY BuyerCode, Country
-- or --
SELECT DISTINCT BuyerCode, Country
FROM Buyer
They should return the same results.
Random Solutions
Cant get vista to view my web site correctly!
Multiple onMouseOut events for different z-index values
How to create Point using ArcGIS?
extract max value with adjacent column data
circular logging for Exchange 2003 backend servers
Server Recommendation (File Server & Terminal Server)
How to allow/disallow with robots.txt a specific directory
Exchange 2007 Certificate
Event ID 37 Microsoft-Windows-Kernel-P
rocessor-P
ower
Blackberry Enterprise Server - not sync contacts for one user?