工具/材料:Management Studio。
1、首先在桌面上,点击“Management Studio”图标。
2、之后在该界面中,点击左上角“新建查询”选项。
3、接着在该界面中,输入两个查询结果运算减的sql语句“SELECT myLGMaterialStock.CountA - myXGMaterialStock.InitCountA FROM myLGMaterialStock left join myXGMaterialStock on myLGMaterialStock.ID= myXGMaterialStock.ID”。
4、然后在该界面中,点击左上方“执行”按钮。
5、最后在该界面中,显示两个查询结果运算减结果。
select (
(select sum(money) as s1 from w_user_money where uid=10086 and money_plusminus=1)
-
(select sum(money) as s2 from w_user_money where uid=10086 and money_plusminus=2)
)
将上面查询的结果当成表再写一个语句
select s1-s2 from (select sum(money) as s1 from w_user_money where uid=10086 and money_plusminus=1),(select sum(money) as s2 from w_user_money where uid=10086 and money_plusminus=2);