When you want to include a filter to above outcomes determined by a relation like table1.id = table2.id You should use Internal JOIN: +----+-------------+--------------------+------------+-------+-------------------------------------------------+-------------------------------------------------+---------+-------------------------------+----------+----------+-------------------------+ ... https://marcoxwsnh.mybjjblog.com/how-to-join-outlaw-motorcycle-clubs-book-no-further-a-mystery-48971199