RES: question, about mysql query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx
Excelência em Softwares Financeiros

-----Mensagem original-----
De: LKSunny [mailto:ad@xxxxxxxx] 
Enviada em: segunda-feira, 2 de junho de 2008 22:20
Para: php-general@xxxxxxxxxxxxx
Assunto:  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



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux