當前位置:首頁 » 編程語言 » sql怎麼求兩列的和
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

sql怎麼求兩列的和

發布時間: 2022-08-03 23:33:29

㈠ mysql資料庫有兩列數據,怎麼求和,具體看詳情!

select sum(case b is null when a else b end) from table;

㈡ SQL語句怎麼實現兩列內容相加

select a+b from table

㈢ sql 如何查詢一個表中的兩列之和

select column1+column2 as 和 from table

㈣ 求SQL兩列數據求和

select IDependCode, sum(money1) as money3 from (select * from table1
union all
select * from table2
) as temp group by IDependCode

㈤ sql語句列求和

select sum(數據1),sum(數據2) from table

如果表裡只有這兩列,則語句如上,如果還有其它列並且需要分組,則添加group by語句,如:
select sum(數據1),sum(數據2) from table
group by 其它列

㈥ sql語句求兩列的(相加)和

select sum(a+b) as c from table

如有疑問:加我:514895860

㈦ 怎麼查詢sql表兩列相加的和

做個簡單的。
兩個數據表db1,db2

查詢結果A是從數據表db1獲取的:
select names, sale from db1

查詢結果B是從數據表db2獲取的:
select names, sale from db2

則查詢結果C:

select names,sum(sale) as sale
from
(select names, sale from db1
union
select names, sale from db2
)
group by names

㈧ sql 計算結果兩列的和

selectsum(xxxx)asa,sum(xxxx)asb,sum(xxxx)+sum(xxxx)ascfromxxxxx

㈨ sql怎麼把一行數據中的幾列相加

1、創建測試表,create table test_num(fee_id number, fee1 number, fee2 number, fee_3 number);