create table test(序号 int,姓名 varchar(20),费用 decimal(5,1))
insert test select 1,'小张',1.2
union all select 2,'小李',1.3
union all select 3,'小王',1.4
union all select 4,'小邓',1.5
select distinct case when (select 费用 from test where 姓名='小李')-(select 费用 from test where 姓名='小王')>0 then
'大于小王'
when (select 费用 from test where 姓名='小李')-(select 费用 from test where 姓名='小王')<0 then
'小于小王'
when (select 费用 from test where 姓名='小李')-(select 费用 from test where 姓名='小王')=0 then
'等于小王' end
from test