我的表(data)中字段如下:
num(字符型) name(字符型) date(日期) late(bit/布而) absent(bit)...
我想用一条sql语句把一段时间的迟到(late),缺席(absent)为真的记录用count()统计出来,和num ,name这些字段一起显示在一个表里面。
我原先的语句如下:
select num,name,count(date) as 迟到 ,count(absent) as 缺席 from data where date>''+datetostr(bdate)+'' and date<''+datetostr(edate)+'' and
late=1 or ...
bdate 起始时间 edate 截止时间
上面代码错误多多。语法上和逻辑上都有错误。
各位师兄,帮帮忙哈。
给点代码:
num(字符型) name(字符型) date(日期) late(bit/布而) absent(bit)...
我想用一条sql语句把一段时间的迟到(late),缺席(absent)为真的记录用count()统计出来,和num ,name这些字段一起显示在一个表里面。
我原先的语句如下:
select num,name,count(date) as 迟到 ,count(absent) as 缺席 from data where date>''+datetostr(bdate)+'' and date<''+datetostr(edate)+'' and
late=1 or ...
bdate 起始时间 edate 截止时间
上面代码错误多多。语法上和逻辑上都有错误。
各位师兄,帮帮忙哈。
给点代码:
from table2 where rq>='2002-10-10' and rq<='2002-10-22' group by num,name以上调试通过
还有我在sql sever 中有一个时间(time)字段,是datetime型的,当我只输入时间时, 系统会自动添上日期在前面,有啥办法把前面的日期给去了喃??
select num,name,count(date) as 迟到 ,count(absent) as 缺席 from data where date>‘''+datetostr(bdate)+''' and date<'''+datetostr(edate)+''' and
late=1 or ...
这样的语句很久没见过了,在SQL里居然可以运行,好!