Two tables (Slightly 0T)
| From: | Ryan A | Date: | Sat, 16 Apr 2005 14:06:40 +0000 |
| Subject: | Two tables (Slightly 0T) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-213196@lists.php.net to get a copy of this message | ||
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".
Thanks,
Ryan
--
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