I am writing a SQL function. I would like to order all of the data from a table (any table, doesnt matter for this question). I would then like to order the data on one column. Then once this order has been performed I would like to extract a few of the columns from the top row (after the ordering).
I dont think I can use partititon by because the ordering is on the whole data, not groups of it?
Im stuck because you can only use ORDER BY at the end of a function
Sounds like a complicated description of a
SELECT TOP 1query:Would order the table by
ColumnBin descending order, then return ColumnsA,DandF.I’m not sure you even need a function.