In general, there is a table with three fields: [name] nvarchar (50) null, [createdDate] date null, [sum] money null. It is required to select three employees to whom for a certain period of time paid the highest amount.
I know how to ask a request to choose the amount of payments for a certain time interval, for example:
select SUM([tst_temp].[sum]) as [сумма] from dbo.tst_temp where createdDate >= '19800101' and createdDate <= '20160801' and [name] = 'Иванов';
I know that I need to use TOR () and GROUP BY to sort and select the desired values. But how to make a final request or I do not understand ...
Help me please.