Quantcast
Channel: Distinct in one column where another column has same values - Database Administrators Stack Exchange
Browsing latest articles
Browse All 2 View Live

Answer by ypercubeᵀᴹ for Distinct in one column where another column has same...

SELECT name, MIN(type) AS type FROM table_name GROUP BY nameHAVING COUNT(DISTINCT type) = 1 ;or the same with: HAVING MIN(type) = MAX(type)I assume that type is not nullable.If you want only those that...

View Article



Distinct in one column where another column has same values

I have a table sample id | name | type-------+--------+------ PR001 | DC001 | a PR002 | DC001 | a PR003 | DC001 | b PR004 | DC002 | a PR005 | DC003 | a PR006 | DC003 | a PR007 | DC004 | b PR008 | DC005...

View Article
Browsing latest articles
Browse All 2 View Live




Latest Images