July 9, 2022 at 4:49 pm
Hi
I have below query & i want to filter data on 2 parameters
Create PROC USP_Book
(
@ID VARCHAR(500),
@sid VARCHAR(500)
)
AS
BEGIN
declare @cols as nvarchar(max)='';
declare @query as nvarchar(max)='';
select @cols = @cols + QUOTENAME(SName) + ',' from (Select distinct SName from View_Book) as tmp
select @cols = substring(@cols,0,len(@cols))
set @query = 'select Title, ' + @cols + ' from (select Title,Status,SName from tblData) x pivot
( Max(Status) for SName in (' + @cols + ')) piv ';
execute (@query)
Thanks
July 10, 2022 at 2:19 am
Normally, you do this in the UI... either PowerBI or Excel... unless you don't want to ever see that data.
you can create a stored procedure and then use that as the source.
July 10, 2022 at 6:26 pm
Ok... that's roughly the same query you've posted two other times. It's not nice to cross post. Stick with one thread on something like this.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply