try this if it works
SELECT nick FROM bt_member LEFT JOIN bt_message ON
bt_member.id=bt_message.mid WHERE bt_message.ch ='$ch'
----- Original Message -----
From: "Sunil Samuel" <[EMAIL PROTECTED]>
To: "Erick" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, June 04, 2003 11:09 PM
Subject: Re: [PHP] How to optimize this MySQL command?


> This is actually more an sql questions. ;-)  Take a look at Joins in
> sql.  Should be something like the following:
>
> SELECT mesg.id, mesg.mid, memb.nick
> FROM bt_message mesg,  bt_member memb
> WHERE mesg.ch='$ch' AND memb.id=mesg.mid
>
> Erick wrote:
>
> >$resultb = mysql_query("SELECT id,mid FROM bt_message where ch='$ch'
",$db);
> >while ($result = mysql_fetch_array($resultb)) {
> >$result2b = mysql_query("SELECT nick FROM bt_member where id
='$result[mid]'
> >",$db);
> >$result2 = mysql_fetch_array($result2b);
> >.........
> >}
> >
> >Can combine together?
> >
> >
> >
> >
> >
>
>
>
> --
> 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

Reply via email to