TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Venkat Govind
1.2k
577
68.2k
How to merge column from two data table in gridview
May 18 2015 7:00 AM
Hi i had three in dataset i want merge column for all three datatable on to display gridview pls post your answer,gridview column is dyanamic creation from depending on selected column i using below stored procedure
DECLARE @query nVARCHAR(max)
DECLARE @column nVARCHAR(max)
DECLARE @TotalPresent int
DECLARE @total int
DECLARE @per decimal
declare @i int
SELECT @column = STUFF(( SELECT'],['+ Tradecat FROM mstr_tradecategory order by '],[' + convert(nVARCHAR(max),UniqueID) FOR XML PATH('')), 1, 2, '') + ']'
SET @query ='SELECT State,' + @column + ' FROM(
SELECT State,Tradecat FROM dbo.mstr_workforce as wf
inner join mstr_state as st on wf.PresentState=st.StateCode
left outer join mstr_tradecategory as tc on tc.TrcatCode=wf.Category
left outer join workforce_attendance as wa on wa.WorkforceID=wf.WorkforceId where wa.AttendanceDate=convert(varchar(20),getdate(),100)) mstr_workforce
PIVOT (count(Tradecat) FOR Tradecat IN ('+@column+')) AS pvt'
(select COUNT(presentState)as TotalPresent from mstr_workforce as wf left outer join workforce_attendance as wa on wa.WorkforceID=wf.WorkforceId where wa.AttendanceDate='05-16-2015' group by presentState)
(select COUNT(presentState)as Total from mstr_workforce as wf left outer join workforce_attendance as wa on wa.WorkforceID=wf.WorkforceId group by presentState)
EXECUTE (@query)
Reply
Answers (
1
)
Sales report to program in VS 2012 Pro
How to connect xampp mysql database to visual studio?