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
how to create a css file to format xml file
User activity in solaries
Exchange 2010 Mailbox Role Installation Error
Two IPs on the same dot com
SQL database issues over ipsec site to site tunnel on Juniper SSG520
Anyone knows what this fruit is called in english and if I can buy it in the USA somewhere even online
how to make an MsAccess form resolution independent?
ISAPI Filter & MOSS2007
DReamwever how to link pages.
I HAVE A SONY VAIO MODEL: VGN-FW351J