sql 两表相减语句表1 表2no sumamt no amt 001 3000 001 1000002 2000 00
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/10/07 10:13:42
sql 两表相减语句
表1 表2
no sumamt no amt
001 3000 001 1000
002 2000 001 500
002 9000
根据no号关联,no=001 表1-表2 3000—(1000+500)
no=002 2000-9000
最后我只要得出相减的结果就行
表1 表2
no sumamt no amt
001 3000 001 1000
002 2000 001 500
002 9000
根据no号关联,no=001 表1-表2 3000—(1000+500)
no=002 2000-9000
最后我只要得出相减的结果就行
select a.no,a.sumamt-b.amt
from table1 as a
,(
select no,sum(amt) as amt
from table2
group by no
) as b
where a.no = b.no
from table1 as a
,(
select no,sum(amt) as amt
from table2
group by no
) as b
where a.no = b.no
sql 两表相减语句表1 表2no sumamt no amt 001 3000 001 1000002 2000 00
SQL语言求助 表名student 共四列:No、Name、birth(四位数值型)、sex(1表示男、0表示女)
请教sql语句,像select …from wsdy_zb t where t.id =:id order by no
通过表1的name与age字段查询出表2的hobby//sql语句怎么写
sql两表各列先求和,后相减,sql语句如何写?三表的又该如何?
求教一个SQL语句.关于2个相同结构表中数据的对比
用SQL语句实现2张表的联立查询,要求包含Where,Order By 字句
sql语句计算满足1+2+…+n
过去式:No.1 climb.No.2 rain.No.3 share.No.4 arrive.No.5 study
SQL> CREATE TABLE Y AS SELECT * FROM X WHERE no=2
java.sql.SQLException:The transaction is no longer active-st
sql语句and 1=1是什么意思?