没有子查询的SQL Server查询

时间:2012-08-09 19:21:31

标签: sql-server-2008-r2

我有以下SQL

set @ID = '323232'

select 
    tt.ItemOrder, tt.DisplayVal,
    ActualDate = (select mfdate from mfseries where Id = @ID)
from 
    tblTime tt

有没有办法简化此查询以不使用子查询?

1 个答案:

答案 0 :(得分:1)

DECLARE @date datetime

select @date = mfdate from mfseries where Id = @ID

select tt.ItemOrder,tt.DisplayVal,@date As ActualDate
from tblTime tt