Re: Two tables (Slightly 0T)

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

 



Hey,
Thanks for replying.

Will look up "join".

> BTW this is a question for the [MySQL General] list at
mysql@xxxxxxxxxxxxxxxx

I know its largly a MySql question, but I am using it via PHP...and thats
why I wrote the OT in the subject...didnt want to tick anyone off.

Cheers,
Ryan


On 4/16/2005 3:57:49 PM, bu@xxxxxxxxxx wrote:
> On Saturday 16 April 2005 17:06, Ryan A wrote:
>
> > Hey,
>
> > My host has MySql 4.0.x so I cant really use the nested selects of 4.1
:-
> (
>
> > please tell me how you solved something like this;
>
> >
>
> > I have two tables:
>
> > users_online (username , dateandtime)
>
> > users_details (cno, username, has_image, image_name)
>
> >
>
> > 1a) I have to select x records from users_online where $username is not
>
> > more than 3 minutes old,
>
> > 1b) then I have to check if that username has_image,if yes, get the
>
> > imagename
>
> >
>
> > I thought of having the imagename also in the users_details, but we are
>
> > allowing our members to
>
> > change/modify their images at will....
>
> >
>
> > What kind of sql do I use above? I dont want to run a query on every
> record
>
> > returned from users_online
>
> > as that would be really "expensive".
>
>
>
> See the JOIN syntax in MySQL. You can join the two tables.
>
>



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.13 - Release Date: 4/16/2005

-- 
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