i have two mysql tables.
the first is called "chosen" and consists of id, user_id, and widget_id fields.
the other is called "widgets" and includes several things including widget_id.
i created a filter so that the user can either display widgets that he/she has chosen, or widgets that he/she hasn't chosen. for the ones he has chosen, i use this:
SELECT *
FROM widgets, chosen
WHERE chosen.user_id = $user_id
AND chosen.widget_id = widgets.widget_id
however, i can't figure out how to display the ones that he/she hasn't chosen. this doesn't work (displays everything):
SELECT *
FROM widgets, chosen
WHERE !( chosen.user_id = $user_id
AND chosen.widget_id = widgets.widget_id)
how do i do this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…