Wednesday 15 February 2012

mysql - SQL where particular column values appears -



mysql - SQL where particular column values appears -

i wasn't sure how search this..

lets have simple table this

id type 1 0 1 1 2 1 3 0 4 0 4 1

how select id's have type of both 0 , 1?

select id,type t grouping id having sum(type=0)>0 , sum(type=1)>0

you grouping id ,than having utilize post aggregation filtering check 0 , 1.

mysql sql

No comments:

Post a Comment