各位高手
本人輸入
sql_command1 -> result_1
sql_command2 -> result_2 現在要result_1 - result_2 sql應點輸入
本人輸入
sql_command1 -> result_1
sql_command2 -> result_2 現在要result_1 - result_2 sql應點輸入
解决方案 »
- 关于一个查询方面的问题,请各位多多指教!先谢了!
- Sql基础
- 系统初始化,添加修改函数表、存储过程、函数的sql
- 有人在吗?帮帮我吧!
- bcp导出数据到文本文件,文件名要按照指定格式生成
- 在xp下安装sql server 2000 时出现 command line option syntax error.type command /?help.
- 请问一个关于grid的问题!(vfp)救急
- 大力,邹建,马可等高手快来帮忙(文本文件导入问题)
- 高手们,可以从不同的把来自不同表的数据同时插入到一个表中吗?
- 这个SQL查询该咋写?谢谢了!!不用子查询。
- SQL SERVER 2005 怎么加换行符
- 尚学堂马士兵在讲解sql试题时似乎有误。望指教。
--SQL1:
select colname3 from tabname where colname1='AAA'--SQL2:
select colname3 from tabname where colname2='BBB'==>select t.colname3 from tabname t where colname1='AAA' and not exists(select 1 from tabname where colname2='BBB' and colname3=t.colname3)
declare @tb1 table (col1 int)
insert into @tb1 select 1 union all
select 2 union all
select 3 union all
select 4
declare @tb2 table (col1 int)
insert into @tb2 select 1 union all
select 2
select * from @tb1 where col1 not in(select col1 from @tb2)
select * from @tb1 a where not exists(select 1 from @tb2 b where b.col1 = a.col1 )
/*
3
4
*/
/*
3
4
*/
结果一样!
2005:
select colname3 from tabname where colname1='AAA'
except
select colname3 from tabname where colname2='BBB'
declare @result_2 decimal(18,2)select @result_1=colA from tab1 where colB='A'
select @result_2=colA from tab1 where colB='C'select @result_1-@result_2