日期:2014-05-17  浏览次数:20489 次

请问如何精简下面几句SQL语句?
set @a=(select thea from tb1 where id=3)
set @b=(select theb from tb1 where id=3)
set @c=(select thec from tb1 where id=3)
set @d=(select thed from tb1 where id=3)


里面select的条件都一致,只是取的字段不同而已,难道给这四个变量赋值要查询4次?能否直接查询一次然后直接四个变量都赋值完呢?
求精简语句谢谢~

------解决方案--------------------
select @a=thea,@b=theb,@c=thec,@d=thed from tb1 where id=3