vf中SQ查询命令

来源:百度知道 编辑:UC知道 时间:2024/05/24 00:13:34
有一道题目是这样的:
检索出工资低于本仓库平均工资的职工信息.
表是这样的
仓库号 职工号 工资
wh2 01 1220
wh1 02 1223
wh2 04 1223
wh3 05 1223
wh1 06 1223
小弟不知道怎样做,请大哥大姐帮帮小弟的忙
不是啊

select *
from 表 A
where 工资< (select avg(工资) from 表 where 仓库号=A.仓库号)

我觉得应该是这样写 因为仓库不唯一,楼上的是低于所有仓库的平均工资 而不是本仓库的的平均工资

sele * from 职工 where 工资<avg(工资)