现在有两个表A,BA表:从其他表中查询出的结果集
num_of_deal num_of_client Assets year
7 9 3000 2007B表:一个常量表
newdeals newclients Assets year
5 6 1000 2007
19 21 4000 2008现在要得这样的结果
num_of_deal num_of_client Assets year
2 3 2000 2007
num_of_deal num_of_client Assets year
7 9 3000 2007B表:一个常量表
newdeals newclients Assets year
5 6 1000 2007
19 21 4000 2008现在要得这样的结果
num_of_deal num_of_client Assets year
2 3 2000 2007
from a,b
where a.num_of_deal>b.num_of_deal and a.num_of_client > b.num_of_client
from a,b
where b.year = 2007
create table A(num_of_deal int,num_of_client int,Assets int,[year] int)
insert into A values(7,9,3000,2007)
create table B(num_of_deal int,num_of_client int,Assets int,[year] int)
insert into B values(5 ,6 ,1000,2007)
insert into B values(19,21,4000,2008)
goselect a.num_of_deal-b.num_of_deal num_of_deal, a.num_of_client - b.num_of_client num_of_client,a.Assets - b.Assets Assets , b.[year]
from a,b
where b.[year] = 2007drop table A,b/*
num_of_deal num_of_client Assets year
----------- ------------- ----------- -----------
2 3 2000 2007(所影响的行数为 1 行)
*/