mysql - Query on a relation table -


i have relation table data. want query returns a_id every connected status equals 1.

so in case, 6 value returned.

a_id b_id status 4     757   0 4     758   0 4     761   0 5     757   1 5     758   0 5     761   1 6     757   1 6     761   1 6     758   1 

mysql 5.5

select distinct a_id relation_table a_id not in (select a_id relation_table status != 1); 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -