Mysql – Is it possible to create mutiple MySQL queries within the same table

MySQL

Is it possible to make multiple queries at once within the same query?

Here is an example of what I'm trying to do.

We have the following table:

| userid | price | stock | description | 
----------------------------------------
  1        10.00   5       some text 
  2        25.00   2       some text
  3        15.00   3       some text
  4        35.00   2       some text
  5        30.00   4       some text

The queries that I'm trying to do are:

  1. the MIN and MAX price group by description
  2. the price set by userid 2
  3. Stock and price of the first three results only without grouping

So the HTML table will look like this:

description | Min_Price | Max_Price | Price Set by userid 2 | 1st Price | 1st Stock | 2nd Price | 2nd Stock | 3rd Price | 3rd Stock

Best Answer

MySQL Unions (http://dev.mysql.com/doc/refman/5.0/en/union.html) should probably put you on the right track.

You could also do most of it with sub selects, though that is probably not a great idea.