In article <[EMAIL PROTECTED]>,
Henry Chang <[EMAIL PROTECTED]> writes:

> Hello everyone,
> I have a table where measurement values are collected in mulitple columns.

> Table Schema
> ==========================================
> ID, measurement_01, measurement_02, measurement_03
> ==========================================
> 1, 300, 350, 325    (max is 350, min is 300)
> 2, 225, 275, 400    (max is 400, min is 225)
> 3, 100, 500, 300    (max is 500, min is 100)
> ==========================================

> My question is that for each row, what's the sql query that determine the
> max value and the min value from all the columns??

[Others told you the answer for that]

> (I realize that each measurment should be it's own row, but I must use the
> table as it is.)

How about the following?

  CREATE VIEW mytblv AS
  SELECT id, measurement_01 AS measurement
  FROM mytbl
  UNION
  SELECT id, measurement_02
  FROM mytbl
  UNION
  SELECT id, measurement_03
  FROM mytbl


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to