Posted by Steve on 08/23/07 07:01
Hi,
I am having trouble achieving the outcome I am looking for with a mysql
query.
The query below pulls information from two tables: profile_images and
name_list.
It pulls 6 random images where the name_list.id matches the
profile_images.vref but also checks that the 'class' field from name_list is
equal to '5'.
$index_thumbs = mysql_query("SELECT DISTINCT * FROM profile_images,
name_list
WHERE profile_images.vref = name_list.id AND name_list.class = '5'
ORDER BY RAND() LIMIT 0,6");
This is working fine for pulling 6 random images that meet those
requirements but I would also like to to make the profile_images.vref /
name_list.id UNIQUE as there are multiple images for each each
name_list.id - So therefore I would like to return 6 unique images from 6
id's in the name_list rather than having cases where multiple images show up
from one name_list.id
I'm hoping this is going to be a simple adjustment to someone who knows what
they're doing :)
Thanks in advance.
Steve
Navigation:
[Reply to this message]
|