Thanks, that's ok but now I need to have the result which would list all table_X a_id's that contain table+Z b_id's with all system flag=0.
I mean all b_id's should be not system. If even one of the b_id's for specific a_id is system, record is not returned.
Is it possible with mysql?