sql - OVER clause. How to order by multiple columns within a CASE clause? -


The following SQL code is a sample of large SQL statements. My question is how I can do case multiple columns by select ROW_NUMBER () similar to the one below command, comment line. The submission code works, but I need to order by two columns.

I have a case using MSSQL when 2008

  SELECT TOP (50) and totals over ROW_NUMBER () (Order @OrderBy = 'Total' (TOTALVIEWS ) and yoga (LastMonthViews) end DESC) positions, as (Albums.TotalViews) TOTALVIEWS, sUM (Albums.LastMonthViews as) as select be implemented by the --The code LastMonthViews album ROW_NUMBER ( ) orders totaling (LastMonthViews) DESC, sUM (TOTALVIEWS) DESC  

you row_number () in division case statement can repeat:

  SELECT TOP (50) ROW_NUMBER () Bridesmaid (The sum ORDER BY (case when @OrderBy = 'Total' (LastMonthViews) and yoga (LastMonthViews) end) DESC, (case when the sum @OrderBy = 'Total' (TOTALVIEWS) and yoga (LastMonthViews) end) DESC), the final churning scene from the album Yoga (album Kulviz) AS Kul Vee Iews, SUM (album. Lustmanthews);  

Comments