sql获取一个个表单中不同字段下拉列表的值 单位上了一套报表工具,可是我以前没有接触过sql,好不容易写出来个语句可是显示出取到的下拉列表值都是一样的,应该怎么改啊
select b.departmentname,a.bjbw,a.jcsj,a.jcdw,a.jcr,a.bianhao,a.wtbh,a.zgyj,a.zgcs,a.yfcs,a.zlr,a.zgsj,a.zyqfh,a.fuhere,a.fhsj,a.aqkfh,a.fhr2,a.fhsj2,a.zxbmxz,a.xigfh,a.fhr,a.shijian,a.kaohyj,a.wentxz,a.wtlb,a.yzcd,a.zhenggai,c.selectname as 问题类别,f.selectname as 整改进度from formtable_main_19 a,hrmdepartment b,workflow_selectitem c,workflow_selectitem f,workflow_billfield d where a.bjdw=b.id and c.fieldid=d.id and f.fieldid=d.id and d.billid=-19 and a.wtlb=c.selectvalue and a.zgjd=f.selectvalue要同时取到“问题类别”和“整改进度”两个下拉列表的值;问题类别应该是管理,设备和人员,整改进度取到的应该是已整改,延期整改字段,还有就是查询出来的数据要按照部门名称按照“作业一区”,“作业二区”,“作业三区”,“作业四区”的顺序排序,数据库里面的部门id是乱的,排不出来,在此求教,不胜感激!!!
select a.zgyj,c.selectname as 问题类别,f.selectname as 整改进度
from formtable_main_19 a,hrmdepartment b,
workflow_selectitem c,workflow_selectitem f,workflow_billfield d
where a.bjdw=b.id and c.fieldid=d.id and f.fieldid=d.id and d.billid=-19
and a.wtlb=c.selectvalue and a.zgjd=f.selectvalue