摘要:
1、建立表1 create table tb2 (3 id int identity(1,1),4 name varchar(20),5 fid int6 )2、插入数据1 insert into tb(name,fid)values('a',0),('b',1)3、查询表如下:4、要求:根据id查询出表中的所有数据,并将与fid相同的id值后name插入查询的查询数据里面。5、查询语句1 select a.id,a.name,a.fid,b.name AS same from tb a,tb b where b.id=a.fid6、得到结果: 阅读全文