Table SchemaCREATE TABLE [dbo].[Rotation] ( [IncNum] [int] IDENTITY (1, 1) NOT NULL , [Filename] [varchar] (1500) , [SingerName] [varchar] (150) NOT NULL , [DateAdded] [datetime] NOT NULL ) ON [PRIMARY]
There is an constraint on Filename/SingerNameExample Table Data:08 Yoakum, Dwight - Crazy Little Thing Called Love Rick 2003-01-06 21:21:30.95709 Sc7522 - 11 - Reba Mcentire - Fancy Brianna 2003-01-06 21:22:05.70710 Creed - My Sacrifice (Sc8765-02) Rick 2003-01-06 21:22:49.41011 Childrens-Traditional - Alphabet Song, The Brianna 2003-01-06 21:23:07.13712 07 Tracy Chapman - Give Me One Reason Kristy 2003-01-06 21:27:22.673
Here is the thing I would like to do.Select the top 2 songs from each singer, unless the record count > 6 then I would like to select 1 song from each singer as return all this as a result set.Something like select top 2 from singers where SingerName = 'Rick'
But do this for all the singers, then return it as one result set or maybe data shaping?Thanks for your help!Rick