Dan Jakubiec wrote:

Hello,

Is there a way to generate a column which computes a value from other
columns in the same query? For example, I want to do something similar to:

SELECT
 MIN(table.myvalue) as min,
 MAX(table.myvalue) as max,
 min/max as derived_column
FROM
 table
ORDER BY
 derived_column
;


This works on a table I have.

SELECT MIN(tone) as `min`, MAX(tone) as `max`, MIN(tone)/MAX(tone) as ratio FROM pltone p

I put the back tick mark around min and max alias, I'm not sure you need it but it is always a good idea anyway.

--
Chris W
KE5GIX

Gift Giving Made Easy
Get the gifts you want & give the gifts they want One stop wish list for any gift, from anywhere, for any occasion!
http://thewishzone.com


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

Reply via email to