sql - select where columnx is less than multiple columns based on row value -
i have data set looks this:
id company value1 value2 value3 value4 value5 value6 1 companyb xxxx xxxx xxxx xxxx xxxx xxxx 2 companyb xxxx xxxx xxxx xxxx xxxx xxxx 3 companyb xxxx xxxx xxxx xxxx xxxx xxxx 4 companya xxxx xxxx xxxx xxxx xxxx xxxx 5 companya xxxx xxxx xxxx xxxx xxxx xxxx 6 companya xxxx xxxx xxxx xxxx xxxx xxxx 7 companya xxxx xxxx xxxx xxxx xxxx xxxx 8 companyc xxxx xxxx xxxx xxxx xxxx xxxx
i want
select * data_set company="companyb" , value1 < value2, value3, value4, value5, or value6
in next step of learning process name of value columns same values in company column
. i:e value1
named companyb
, value2
named companya
. can fetch rows companies values lower @ least 1 other company' value? or have search each company 1 one?
if want check if value smaller any of set of values, compare against largest of values:
select ... value1 < max(value2, value3, value4, value5, value6)
Comments
Post a Comment