Hello,
I have an existing table that i want to copy in a new table. But in the new table i want only the first following order. So below what i do the query works when i delete the last line (order by). But i need this because i only want to select the following orderNo
UPDATE TOP (1)
[ SERVER2
].
[DATABASE2].[dbo].[NextOrder]
SET order_number = C.OrderNo
FROM
[ SERVER2
].[
DATABASE2
].[dbo].[NextOrder] P
INNER JOIN
[ SERVER1
].[DATABASE1].[dbo].[Orders] C
ON C.Resource = P.ResourcesID
where [StartTime] >= CURRENT_TIMESTAMP and Resource = 5
order by [StartTime]