DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(mysql.info.gz) example-user-variables

Info Catalog (mysql.info.gz) example-Maximum-column-group-row (mysql.info.gz) Examples (mysql.info.gz) example-Foreign keys
 
 3.6.5 Using User Variables
 --------------------------
 
 You can use MySQL user variables to remember results without having to
 store them in temporary variables in the client.   Variables.
 
 For example, to find the articles with the highest and lowest price you
 can do this:
 
      mysql> SELECT @min_price:=MIN(price),@max_price:=MAX(price) FROM shop;
      mysql> SELECT * FROM shop WHERE price=@min_price OR price=@max_price;
      +---------+--------+-------+
      | article | dealer | price |
      +---------+--------+-------+
      |    0003 | D      |  1.25 |
      |    0004 | D      | 19.95 |
      +---------+--------+-------+
 
Info Catalog (mysql.info.gz) example-Maximum-column-group-row (mysql.info.gz) Examples (mysql.info.gz) example-Foreign keys
automatically generated byinfo2html