Re: Re: Two tables (Slightly 0T)
| From: | Ryan A | Date: | Sat, 16 Apr 2005 15:03:28 +0000 |
| Subject: | Re: Re: Two tables (Slightly 0T) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-213201@lists.php.net to get a copy of this message | ||
Hey,
Thanks for replying.
I know, I need to start brushing up on my Sql, problem is I rarely need to
use much other than
a simple select,update,insert.
Sorry I didnt write my where query before...this is what i am using:
SELECT last_online from
members_online WHERE
last_online > DATE_sub(NOW(),INTERVAL 5 MINUTE );
Cheers,
Ryan
On 4/16/2005 4:29:27 PM, Matthew Weier O'Phinney (matthew@garden.org) wrote:
> * Ryan A <ryan@coinpass.com>:
>
> > 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".
>
>
>
> You're right, this is OT, but I'll answer anyways.
>
>
>
--
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