全部博文(788)
分类:
2009-02-19 17:03:24
--增加字段sk
alter table aa add sk varchar(4) null
go
--更新字段sk
update aa set sk= 'K' from aa a,bb b where a.jb = b.jh and a.yxh between b.jd1 and b.jd2
go
--查询
select * from aa a,cc b where a.jh =b.jh and a.sk='K' and a.yx>=0.4 and c.hs>=0.3 and c.年月=combobox中的值
在DELPHI中有个专门选择日期的控件DateTimePicker,比combobox更好
select jh,yc,yx,yhx from (select aa.*, 'sk' = case when aa.yxh >= bb.jd1 and aa.yxh<=bb.jd2 then 'K', else '' from aa, bb where aa.jh = bb.jh) XXX, cc where yx>=0.4 and sk='k' and hs>=0.3
select jh,yc,yx,yhx from (select aa.*, 'sk' = case when aa.yxh >= bb.jd1 and aa.yxh<=bb.jd2 then 'K', else '' end from aa, bb where aa.jh = bb.jh) XXX, cc where yx>=0.4 and sk='k' and hs>=0.3
修改一下,少了个end