The question is the following, there are some number of scripts, they write the results of their work in the database. This query simply selects the last 10 records sorted by date, after which PHP builds a table with the latest records based on the response received, but all the scripts are mixed there.
SELECT TOP 10 [name] ,[description] ,[date] ,[status] FROM [script_monitoring].[dbo].[status] order by DATE desc How to improve this query so that the answer is of the same kind, only for each script individually? It would be possible to organize a cycle with requests for each script name separately, but instead of 1 request, using 10 seems to me stupid. Can temporary tables help in this issue? It is important that this is a complete request.
select top 10sort theorder by поле. More exhaustive information on this issue can not be designated. - nick_n_a FebruaryROW_NUMBER() OVER (PARTITION BY [script_id] ORDER BY [date] DESC). - Akina