日期:2014-05-17 浏览次数:20440 次
create table Goods( id int, name varchar(30), price int, sum int, sid int, creator varchar(20), createtime varchar(20), tid int ) insert into Goods values('3','小碗熊','24','3','1','小明','2012年','3') drop table Supplier drop table MyTypes drop table Goods create table Supplier( sid int, name varchar(20), linkman varchar(20), tel varchar(20) ) insert into Supplier values('3','小明服饰','小张','13798542123') create table MyTypes( tid int, name varchar(20) ) insert into MyTypes values('3','饼干') select top 2 c.id,c.name,c.price,c.sum,c.creator,c.createtime,Supplier.linkman,Supplier.tel from Supplier,(select id,Goods.name,price,sum,sid,creator,createtime,MyTypes.name from Goods,MyTypes where MyTypes.tid=Goods.tid)as c where c.sid=Supplier.sid
select a.name as name1,b.name as name2 ...