php - MySQL, JOIN over multiple tables & Not IN? -
in application (image voting) have several roles user, voter & admin.
the select user looks this:
select * wp_awa_upload, category, subcategory wp_awa_upload.uid = '$_session[id]' , wp_awa_upload.parent_cat = category.cat_id , wp_awa_upload.sub_cat = subcategory.id a user can see own images, voter should see images on had not voted. when voter voting, there new entry table "wp_awa_session" id of uploaded image , own id. select above has adopted "and session_id , uploaded id not in table wp_awa_session" condition.
how can achieve this?
this correct select :-)
select * wp_awa_upload wau join category c on ( wau.parent_cat = c.cat_id ) join subcategory s on s.id = wau.sub_cat status = '1' , ( wau.id, wau.uid ) not in ( select upload_id, user_id wp_awa_session user_id = '$_session[id]' , upload_id = wau.id ) thanks :-)
Comments
Post a Comment