Quantcast
Channel: mysql "and" logic within result set - Stack Overflow
Browsing all 4 articles
Browse latest View live

Answer by fthiella for mysql "and" logic within result set

This should return the rows that you want: SELECT foo.* FROM foo WHERE employeeID IN ( SELECT employeeID FROM foo GROUP BY employeeID HAVING COUNT(DISTINCT employeeType) = (SELECT COUNT(DISTINCT...

View Article



Answer by Mateo Barahona for mysql "and" logic within result set

You can try a subquery to make it dynamic SELECT employeeID, employeeType FROM foo WHERE employeeID IN ( SELECT employeeID FROM foo GROUP BY employeeID HAVING COUNT(DISTINCT employeeType) = (SELECT...

View Article

Answer by Sarath Chandra for mysql "and" logic within result set

I agree that this might be looked down as a very inefficient/hacky way of doing things, but this should still get the job done. And frankly, I can't see any other way out of this. SELECT * FROM (...

View Article

mysql "and" logic within result set

Say I have a data set like the following: table foo id | employeeType | employeeID ------------------------- 1 | Developer | 1 2 | Developer | 2 3 | Developer | 3 4 | Manager | 1 5 | Manager | 4 6 |...

View Article
Browsing all 4 articles
Browse latest View live




Latest Images