或select id,
sum(case type when '缺勤' then 1 else 0 end) as 缺勤
sum(case type when '早退' then 1 else 0 end) as 早退
sum(case type when '迟到' then 1 else 0 end) as 迟到
from table1 group by id order by idSQL日期
select * from table1 where selldate> :D1 and selldate < :d2
query1.Params[0].AsDateTime:=StrtoDateTime('2002-05-28 19:00:00');
query1.Params[0].AsDateTime:=StrtoDateTime('2002-05-28 19:10:00');
sum(case type when '缺勤' then 1 else 0 end) as 缺勤
sum(case type when '早退' then 1 else 0 end) as 早退
sum(case type when '迟到' then 1 else 0 end) as 迟到
from table1 group by id order by idSQL日期
select * from table1 where selldate> :D1 and selldate < :d2
query1.Params[0].AsDateTime:=StrtoDateTime('2002-05-28 19:00:00');
query1.Params[0].AsDateTime:=StrtoDateTime('2002-05-28 19:10:00');
解决方案 »
- 某一列纠正错别字问题:
- sql建表疑问
- SET DATEFIRST 选项设置对 DATENAME(WEEKDAY, date) 结果有影响吗?
- 行列交叉的問題
- 在线等!数据库连接问题:局域网可以访问,但外部公用网不能访问。求高手解答
- 请问:我想把表中重复了的数据行全部删除应该怎么操作?
- 我的SQL SERVER 2000,卸载一次以后装不上了,HELP!
- 为什么执行select语句以后会出现sqlca.sqlerrtext=“无效的SQL数据类型”?
- 关于自增字段“补缺”的方法(欢迎讨论)
- 如何将EXCEL格式文件的内容一条条的用DELPHI程序转换到一给定字段的DBF库中?
- Access中怎么调试SQL语句?
- 如何建立ODBC的批处理啊!!(重发)
with query1 do
begin
close;
sql.Clear;
sql.add('select * from m111 where name like '''+edit1.Text+'''');
Open;
end;
[email protected]
先结账