i have 2 tables on database. 1 table has categories , other 1 has posts. in category table have column called "active".
what i'm trying do, select posts have category=0.
here's select got far:
select tb_posts.*, tb_categories.active tb_posts, tb_categories tb_categories.active='0' order datapub desc the above query doesn't work loads posts not matter category status. :(
you need left join:
select tp.*, tc.active tb_posts tp left join tb_categories tc on tb.category_id = tc.id tc.active='0' order datapub desc the join done on category column (replace proper column name - guess) (probably) referencing id in tb_categories (again, replace name).
for exact query, please show table structures.
Comments
Post a Comment