You are here: Unique Image Query « PHP SQL « IT news, forums, messages
Unique Image Query

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация