RES: [PHP] question, about mysql query

From: Date: Tue, 03 Jun 2008 11:58:57 +0000
Subject: RES: [PHP] question, about mysql query
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-274955@lists.php.net to get a copy of this message
Didn't read everything but if you just don't want duplicates, can't select distinct help you? Atenciosamente, www.softpartech.com.br Thiago Henrique Pojda Desenvolvimento Web +55 41 3033-7676 thiago.pojda@softpartech.com.br Excelência em Softwares Financeiros -----Mensagem original----- De: LKSunny [mailto:ad@pc86.com] Enviada em: segunda-feira, 2 de junho de 2008 22:20 Para: php-general@lists.php.net Assunto: [PHP] question, about mysql query 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

« previous php.general (#274955) next »