日期:2014-05-16  浏览次数:20383 次

关于变量定义精简
请问一下各位大大.. 以下四个栏位都使用同一条件的话.. 可以精简成一行吗?

select @ItemName= (select itemname from shop where itemname = @Title)
select @ItemPrice= (select point from shop where itemname = @Title)
select @ItemInex= (select itemindex from shop where itemname = @Title)
select @AccectMsg= (select accectmsg from shop where itemname = @Title)
------解决方案--------------------
可以的:

select @ItemName = itemname ,
       @ItemPrice= point,
       @ItemInex = itemindex,
       @AccectMsg= accectmsg
from shop 
where itemname = @Title