Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT TOP 20 *
- FROM (SELECT [t1].[id] AS [t1_ID],
- [t1].[_stamp] AS [t1__stamp],
- [t1].[status] AS [t1_Status],
- [t2].[name] AS [t2_Name],
- [t1].[notificationnumber] AS [t1_NotificationNumber],
- [t1].[ordername] AS [t1_OrderName],
- [t1].[lot] AS [t1_Lot],
- [t3].[startprice] AS [t3_StartPrice],
- [t1].[placerinfo] AS [t1_PlacerInfo],
- [t4].[fullname] AS [t4_FullName],
- [t1].[publisheddate] AS [t1_PublishedDate],
- [t1].[p1date] AS [t1_p1Date],
- [t1].[p2date] AS [t1_p2Date],
- [t1].[stage] AS [t1_Stage],
- [t5].[name] AS [t5_Name],
- [t1].[lastchangedate] AS [t1_LastChangeDate],
- Row_number()
- OVER (
- ORDER BY t1.[id] DESC) AS ROW_NUMBER
- FROM [notificationzk] t1 WITH(nolock)
- LEFT JOIN [notificationzkstagees] t5 WITH(nolock)
- ON t5.[id] = t1.[stage]
- LEFT JOIN [organizationinfos] t4 WITH(nolock)
- ON t4.[id] = t1.[placerinfo]
- LEFT JOIN [notificationzklots] t3 WITH(nolock)
- ON t3.[id] = t1.[lot]
- LEFT JOIN [notificationzkstatuses] t2 WITH(nolock)
- ON t2.[id] = t1.[status]
- WHERE ( t1.[isgroupnotificationzk] = false )
- AND ( t1.[istemplate] = false )
- AND ( ( t1.[zktype] = 1 )
- OR ( t1.[zktype] = 3 ) )
- AND ( ( t1.[isprivate] = false )
- OR ( t1.[placer] = 586003 )
- OR ( t1.[initiator] = 586003 )
- OR ( EXISTS (SELECT t6.[notificationzk]
- FROM [customerrequirementzk] t6
- WHERE ( t6.[notificationzk] = t1.[id] )
- AND ( t6.[customer] = 586003 )) ) )
- AND ( ( t1.[placer] = 586003 )
- OR ( t1.[initiator] = 586003 )
- OR ( EXISTS (SELECT t7.[notificationzk]
- FROM [customerrequirementzk] t7
- WHERE ( t7.[notificationzk] = t1.[id] )
- AND ( t7.[customer] = 586003 )) ) )
- AND ( t1.[islot] = false )) AS [QueryRN]
- WHERE row_number BETWEEN 1 AND 20
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement