maghiel
03-12-2007, 11:16 AM
(sorry for the bad title, couldnt come up with a good one ;))
i have 3 tables:
tbl1
-------
id
userid
info
-------
user
-------
id
groupid
-------
group
-------
id
-------
Now I need to get tbl1.info for all the users with the same groupid set.
I currently do this using a loop, but im sure it could be done better.
Anyone has any idea on this?
the loop is somthing like
SELECT `id` FROM `user` WHERE `groupid` = '5';
// LOOP
SELECT `info` FROM `tbl1` WHERE `userid` = 'resultfromthequeryeabove';
// END LOOP
i have 3 tables:
tbl1
-------
id
userid
info
-------
user
-------
id
groupid
-------
group
-------
id
-------
Now I need to get tbl1.info for all the users with the same groupid set.
I currently do this using a loop, but im sure it could be done better.
Anyone has any idea on this?
the loop is somthing like
SELECT `id` FROM `user` WHERE `groupid` = '5';
// LOOP
SELECT `info` FROM `tbl1` WHERE `userid` = 'resultfromthequeryeabove';
// END LOOP