我正在使用SQL語言。我想結合查詢的結果。 這是我的代碼和預期的輸出。結合查詢的結果在sql
create table customer(name varchar,dpt varchar);
insert into customer (name,dpt)VALUES ('albe','cse');
insert into customer (name,dpt)VALUES ('bine','cse');
insert into customer (name,dpt)VALUES ('alfred','ece');
insert into customer (name,dpt)VALUES ('booshan','ece');
insert into customer (name,dpt)VALUES ('antony','eee');
insert into customer (name,dpt)VALUES ('job','ece');
查詢1:
select
dpt,
count(name)
from customer
where dpt='ece' or dpt='cse'
group by dpt;
結果:
| dpt | count |
|-----|-------|
| cse | 2 |
| ece | 3 |
我所需要的結果爲:
| cse/ece | 5 |
怎麼可能? sqlfiddle是在這裏:
http://sqlfiddle.com/#!12/a1c88/13
謝謝.....它運作良好。 –