日期:2014-05-17 浏览次数:20764 次
----------------------------------------------------------------
-- Author :DBA_Huangzj(發糞塗牆)
-- Date :2013-12-30 09:30:25
-- Version:
-- Microsoft SQL Server 2012 (SP1) - 11.0.3128.0 (X64)
-- Dec 28 2012 20:23:12
-- Copyright (c) Microsoft Corporation
-- Enterprise Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200: )
--
----------------------------------------------------------------
--> 测试数据:[A]
if object_id('[A]') is not null drop table [A]
go
create table [A]([gid] int,[goodsno] varchar(2),[intercode] int,[pro] varchar(3))
insert [A]
select 1,'bb',555,'dan' union all
select 2,'cc',666,'xie' union all
select 3,'dd',777,'wan' union all
select 4,'ee',888,'ws' union all
select 5,'vv',999,'sa'
if object_id('[B]') is not null drop table [B]
go
create table [B]([gid] int,[pro] varchar(4),[intercode] int,[dw] varchar(1))
insert [B]
select 1,'dan',555,'s' union all
select 2,'xie',666,'s' union all
select 6,'xiao',222,'s'
--------------开始查