select lowest,highest value from multiple column mysql
by Jayanthi[ Edit ] 2013-10-14 13:12:32
select lowest,highest value from multiple coloumn
product name | qual_no1 | qual_no2 | qual_no3 |
---|
moong dal | 176 | 89 | 100 |
Compare multiple columns get lowest,higest price
select * ,
least(qual_no1, qual_no2, qual_no3) as lowprice,
greatest(qual_no1, qual_no2, qual_no3) as highprice from product
where productname = 'moong dal' order by lowest_price
output
product name | qual_no1 | qual_no2 | qual_no3 | lowprice | highprice |
---|
moong dal | 176 | 89 | 100 | 89 | 176 |