表:A
字段: sno(序号唯一的),user_id(用户ID) ,name(姓名),
数据如下:
20081215001 ,001,AAAA
20081215002 ,002,BBBB表:B
字段: sno,qty(数量)
20081215001 ,2
20081215001 ,3
20081215001 ,4
20081215001 ,5
20081215002 ,10
20081215002 ,30
20081215002 ,40
20081215002 ,50并且:A.sno = B.sno统计用户user_id = 001 的所有数量和,怎么写SQL 呢?
字段: sno(序号唯一的),user_id(用户ID) ,name(姓名),
数据如下:
20081215001 ,001,AAAA
20081215002 ,002,BBBB表:B
字段: sno,qty(数量)
20081215001 ,2
20081215001 ,3
20081215001 ,4
20081215001 ,5
20081215002 ,10
20081215002 ,30
20081215002 ,40
20081215002 ,50并且:A.sno = B.sno统计用户user_id = 001 的所有数量和,怎么写SQL 呢?
from A,B
where A.sno = B.sno and A.user_id = '001' ;
from a, b
where a.sno = b.sno
and a.user_id = '001'
group by a.name;