Re: fix my query please
| From: | Papp Gyozo | Date: | Wed, 29 Aug 2001 22:47:29 +0000 |
| Subject: | Re: fix my query please | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-65125@lists.php.net to get a copy of this message | ||
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 <erisen@yahoo.com>
To: <php-general@lists.php.net>
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 <jeremy@prepresshelp.com> 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="$usersleft<br>";
> >
> > echo $my_string;
> > }
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail:
> > php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail:
> > php-general-help@lists.php.net
> > To contact the list administrators, e-mail:
> > php-list-admin@lists.php.net
> >
>
>
> =====
> 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: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>