日期:2014-05-17 浏览次数:20639 次
SELECT A.MAN_ID,A.MAN_NAME,A.ZW_ID,B.ZW_NAME,C.MONEY FROM MAN A
LEFT JOIN ZW B ON A.ZW_ID=B.ZW_ID
LEFT JOIN GZ C ON A.MAN_ID=C.MAN_ID
----------------------------
-- Author :TravyLee(物是人非事事休,欲语泪先流!)
-- Date :2012-12-11 10:35:32
-- Version:
-- Microsoft SQL Server 2012 - 11.0.2100.60 (Intel X86)
-- Feb 10 2012 19:13:17
-- Copyright (c) Microsoft Corporation
-- Enterprise Edition: Core-based Licensing on Windows NT 6.1 <X86> (Build 7601: Service Pack 1)
--
----------------------------
--> 测试数据:[Man]
if object_id('[Man]') is not null drop table [Man]
go
create table [Man]([Man_Id] int,[Man_Name] varchar(4),[Zw_Id] int)
insert [Man]
select 1,'张飞',2 union all
select 2,'曹操',1
--> 测试数据:[Zw]
if object_id('[Zw]') is not null drop table [Zw]
go
create table [Zw]([Zw_Id] int,[Zw_Name] varchar(6))