Sql Select Query

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
php_matt_k
Forum Newbie
Posts: 6
Joined: Thu Nov 06, 2003 3:47 pm

Sql Select Query

Post by php_matt_k »

I need help with a select query. I have a database of products.
Each product has a category, and a sold field. There are say.. 10 products per category. I need a sql statement that will give me a set of random unique products, 1 from each category, and order the whole set by the count sold. Can this be done? Thanks for your help. If not in mysql.. what is the fastest, most efficient way to do this with arrays or somthing. I have somthing that works already, but its bulky and slow, i figured i could acomplish it all with the right query. Anyways.. thanks.
Post Reply