22,210
社区成员
发帖
与我相关
我的任务
分享
SELECT min(Id), LineId, ControlId, Direction, FieldNo, Remark, Longitude
FROM
(SELECT a_1.Id, a_1.LineId, a_1.ControlId, a_1.Direction, a_1.FieldNo, a_1.Remark,
T_L_Station.Longitude, T_L_Station.Latitude FROM
(SELECT Id, LineId, ControlId, Direction, FieldNo, Remark FROM T_S_ControlLine) AS a_1
LEFT OUTER JOIN T_L_Station ON a_1.LineId = T_L_Station.LineId AND a_1.Direction = T_L_Station.Direction) AS A
group by LineId, ControlId, Direction, FieldNo, Remark, Longitude
WITH CTE AS(
SELECT GprsId ,LineType ,Name,IsSubLine FROM T_L_Line ),
CTE2 AS
(SELECT Longitude, Latitude,OrderNo FROM T_L_Station)
SELECT Id, LineId, ControlId, Direction, FieldNo, Remark, Longitude, Latitude, GprsId ,LineType ,Name,IsSubLine
(SELECT TOP (1) ScreenNo FROM T_S_Controls AS f WHERE (ControlId = a.ControlId)) AS ScreenNo
from T_S_ControlLine a join CTE b on b.LineId = a.LineId
join CTE2 c on c.LineId = a.LineId) AND c.Direction = a.Direction
declare @a datetime
select @a = getdate()
--select * from tb
declare @int int
set @int = 0
while @int <1000000
begin
set @int = @int +1
end
declare @b datetime
select @b = getdate()
select datediff(ms,@a,@b)