简体   繁体   中英

SQL Query to get distinct results from one table and match those results to the another column in the table

I have an SQL table with product names in one column and a product category in another column. So each product belongs to a specific category. I am trying to figure out an sql command that will return distinct values from the product name column but will also display the product category each product belongs to. Any ideas?

你可以这样试试

  SELECT Distinct([ProductName]),[ProductCategeory] FROM [DB].[dbo].[tblProduct]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM