BH XB CJ
01 男 4
02 男 3
03 女 5
04 男 5
05 女 4
能否只查一次,就能查出以下结果:
总人数:5
男生数:3
女生数:2
男生总成绩:12
一次能否查出来,用什么语句?多谢了!!
01 男 4
02 男 3
03 女 5
04 男 5
05 女 4
能否只查一次,就能查出以下结果:
总人数:5
男生数:3
女生数:2
男生总成绩:12
一次能否查出来,用什么语句?多谢了!!
解决方案 »
- 送分100分:取一个INTEGER数值5800($E290)的高字节,即E2
- 请教delphi7 ADO问题
- 指针,字符串长度问题? 增分贴
- 一个怪问题,我连接串上写127.0.0.1不行,但是什么也不写却能连上
- EOleException: 不能设置 comm 状态, 可能有一个或多个无效的通讯参数。
- 这段代码为什么出错呢?
- 帮我改一改我的DLL文件,谢谢!
- 用过dxDBTreeList的兄弟过来帮看看~~~
- 请问delphi中,或系统中的小图标在哪个目录下啊
- 怎么样在edit中输入固定格式的日期?
- 在前台中打開數據庫裡面的文件
- 转 Borland称12家公司有意接收Delphi和JBuilder
(select count(*)from Table where xb='男')as 男生数,
(select count(*)from Table where xb='女')as 女生数,
(select sum(CJ)from Table where xb='男')as 男生总成绩
请问怎么取这四个值呀
(select count(*)from Table where xb='男')as 男生数,
(select count(*)from Table where xb='女')as 女生数,
(select sum(CJ)from Table where xb='男')as 男生总成绩
是不是这样写呀adoquery1.FieldByName('总人数').AsString;
adoquery1.FieldByName('男人数').AsString;
adoquery1.FieldByName('女生数').AsString;
adoquery1.FieldByName('男人总成绩').AsString;
from tab
where 1=1
group by xb
with cube'
______________
查出后,四个值被升序排列了,如
2
3
5
12
怎样准确得到呢?
下一步知道怎么分别取出值了吧?
var
i: integer;
begin
With ADOQuery1 do
begin
Close;
SQL.Text := '(select Count(*) as 总人数 from main) union all (select Count(*) as 男生数 from main where xb=''男'') union all (select Count(*) as 女生数 from main where xb=''女'') union all (select Sum(cj) as 男生总成绩 from main where xb=''男'')';
Open;
First;
while (not eof) do
begin
ShowMessage(FieldValues['总人数']);
Next;
end;
end;
end;