two table, tablea and tableb tablea uid, col1, col2, col3 1, xx, xx, xx 2, xx, xx, xx 3, xx, xx, xx tableb id, uid, col1, firstdata 1, 1, xx, 1 2, 2, xx, 0 3, 2, xx, 0 4, 1, xx, 0
i want query tablea, and join tableb, uid is associate, ok "LEFT JOIN `tableb` b ON a.uid = b.uid", and than i want tableb firstdata=1 or tableb no associate uid "b.firstdata=1 OR b.uid IS NULL", by the time all ok, but i want add one case, if tableb firstdata all is 0, result one row, like b.uid IS NULL, i don't know how to i want result is all tablea data no double, tableb one case firstdata is 1 (one uid in tableb just one row possible is firstdata=1), or no row in tableb, or all firstdata = 0 Thank You Very Much !! This query can't SELECT a.*, b.* FROM `tablea` a LEFT JOIN `tableb` b ON a.uid = b.uid WHERE (b.firstdata=1 OR b.firstdata=0 OR b.uid IS NULL) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php