Re: [PHP] fix my query please
Hello Jeremy, Two things: FROM users LEFT OUTER JOIN picks using(id) Where users.uid picks.user_id 1- when you do OUTER join, you do NOT have to use the . That's what outher join means. 2- what is id? Is it a column? shouldn't it be uid? Maybe that's your problem. --- Jeremy Morano [EMAIL PROTECTED] wrote: an somebody please fix up my query. $connection = @mysql_connect(l, c, c) or die(Couldn't connect.); $db = @mysql_select_db($db_name, $connection) or die(Couldn't select database.); $sql = SELECT distinct users.uid , users.username FROM users LEFT OUTER JOIN picks using(id) Where users.uid picks.user_id ; $result = @mysql_query($sql,$connection) or die(Couldn't execute query.); while ($row = mysql_fetch_array($result)) { $usersleft = $row['username']; $uid = $row['uid']; $my_string=$usersleftbr; echo $my_string; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] = Mehmet Erisen http://www.erisen.com __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] fix my query please
Well, T1 INNER JOIN T2 For each row R1 of T1, the joined table has a row for each row in T2 that satisfies the join condition with R1. T1 LEFT OUTER JOIN T2 First, an INNER JOIN is performed. Then, for each row in T1 that does not satisfy the join condition with any row in T2, a joined row is returned with NULL values in columns of T2. Thus, the joined table unconditionally has at least one row for each row in T1. and as you can see join condition is nothing to do with equality of respective columns, which means you can state any kind of join condition (non-equal as well as equal join) - Original Message - From: ERISEN, Mehmet Kamil [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, August 28, 2001 10:46 PM Subject: Re: [PHP] fix my query please Hello Jeremy, Two things: FROM users LEFT OUTER JOIN picks using(id) Where users.uid picks.user_id 1- when you do OUTER join, you do NOT have to use the . That's what outher join means. 2- what is id? Is it a column? shouldn't it be uid? Maybe that's your problem. --- Jeremy Morano [EMAIL PROTECTED] wrote: an somebody please fix up my query. $connection = @mysql_connect(l, c, c) or die(Couldn't connect.); $db = @mysql_select_db($db_name, $connection) or die(Couldn't select database.); $sql = SELECT distinct users.uid , users.username FROM users LEFT OUTER JOIN picks using(id) Where users.uid picks.user_id ; $result = @mysql_query($sql,$connection) or die(Couldn't execute query.); while ($row = mysql_fetch_array($result)) { $usersleft = $row['username']; $uid = $row['uid']; $my_string=$usersleftbr; echo $my_string; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] = Mehmet Erisen http://www.erisen.com __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] fix my query please
It has outer joins: http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#JOI N HTH Sam Masiello Software Quality Assurance Engineer Synacor (716) 853-1362 x289 [EMAIL PROTECTED] -Original Message- From: Martín Marqués [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 28, 2001 4:35 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject:Re: [PHP] fix my query please On Mar 28 Ago 2001 17:29, Jeremy Morano wrote: an somebody please fix up my query. $connection = @mysql_connect(l, c, c) or die(Couldn't connect.); $db = @mysql_select_db($db_name, $connection) or die(Couldn't select database.); $sql = SELECT distinct users.uid , users.username FROM users LEFT OUTER JOIN picks using(id) Am I an ignorant, or MySQL doesn't have OUTER JOINs Where users.uid picks.user_id ; [snip] Saludos... :-) -- Porqué usar una base de datos relacional cualquiera, si podés usar PostgreSQL? - Martín Marqués |[EMAIL PROTECTED] Programador, Administrador, DBA | Centro de Telematica Universidad Nacional del Litoral - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] fix my query please
On Mar 28 Ago 2001 17:29, Jeremy Morano wrote: an somebody please fix up my query. $connection = @mysql_connect(l, c, c) or die(Couldn't connect.); $db = @mysql_select_db($db_name, $connection) or die(Couldn't select database.); $sql = SELECT distinct users.uid , users.username FROM users LEFT OUTER JOIN picks using(id) Am I an ignorant, or MySQL doesn't have OUTER JOINs Where users.uid picks.user_id ; [snip] Saludos... :-) -- Porqué usar una base de datos relacional cualquiera, si podés usar PostgreSQL? - Martín Marqués |[EMAIL PROTECTED] Programador, Administrador, DBA | Centro de Telematica Universidad Nacional del Litoral - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]