一表t1:
商品编码 商品名 数量
------------------------
c 牙膏 1
b 毛巾 2
a 杯子 1一表t2:
序号 商品编码
---------------
1 a
2 b
3 c我想按照表t2的序号升序排序后,按照得到下结果:
商品编码 商品名 数量
------------------------
a 杯子 1
b 毛巾 2
c 牙膏 1求语句:
商品编码 商品名 数量
------------------------
c 牙膏 1
b 毛巾 2
a 杯子 1一表t2:
序号 商品编码
---------------
1 a
2 b
3 c我想按照表t2的序号升序排序后,按照得到下结果:
商品编码 商品名 数量
------------------------
a 杯子 1
b 毛巾 2
c 牙膏 1求语句:
where t1.商品编码=t2.商品编码
order by t2.序号
declare @tb table([商品编码] varchar(1),[商品名] varchar(4),[数量] int)
insert @tb
select 'c','牙膏',1 union all
select 'b','毛巾',2 union all
select 'a','杯子',1select * from @tb order by 商品编码