select title,sum(score) from e_bill where title ='aa' group by i_ship_id
select title,sum(score) from e_bill where title ='aa' group by title
可能我描述有误, 表A结构 id title score 1 aa 1 2 bb 2 3 cc 3我知道的条件是知道id,我要得到的结果是: title score aa 6 请问怎样用一句SQL语句实现。
select title,sum(score) score from a where id='1' group by title
表A结构 Aid Bid title ascore 1 2 aa 1 2 1 bb 2 3 1 cc 3表B结构 id bscore 1 12 2 18我知道的条件是知道表B的id,我要得到的结果是: bscore score 12 5 请问怎样用一句SQL语句实现。
表B的id未确定 如: bscore score id 12 5 1 18 1 2 的SQL语句: select bscore,sum(ascore) score from A,B where B.id=A.Bid; 知道表B的id的SQL语句: select bscore,sum(ascore) score from A,B where B.id=A.Bid and B.id=传进来的值;
select t1.title,sum(t2.sex) from a t2 left join a t1 on t1.id=1 group by t1.id;
select t1.title,sum(t2.sex) from a t2 left join a t1 on t1.id=1 group by t1.title;
group by i_ship_id
group by title
表A结构
id title score
1 aa 1
2 bb 2
3 cc 3我知道的条件是知道id,我要得到的结果是:
title score
aa 6
请问怎样用一句SQL语句实现。
Aid Bid title ascore
1 2 aa 1
2 1 bb 2
3 1 cc 3表B结构
id bscore
1 12
2 18我知道的条件是知道表B的id,我要得到的结果是:
bscore score
12 5
请问怎样用一句SQL语句实现。
如:
bscore score id
12 5 1
18 1 2
的SQL语句:
select bscore,sum(ascore) score from A,B where B.id=A.Bid;
知道表B的id的SQL语句:
select bscore,sum(ascore) score from A,B where B.id=A.Bid and B.id=传进来的值;