1
Reply

How to display data value from two datatable c# asp.net?

Ask a question
How to display data value from two datatable c# asp.net? how can i display merge two table column on to display on gridview , I am using gridview , Idynamic creation column , I want to display total present and total same column , i want to display equal to state total and total present and i am i also calculate percentage depending on total and total present for each state Pls provide solution thank u...
 
DECLARE @query nVARCHAR(max)
DECLARE @column nVARCHAR(max)
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
inner join mstr_tradecategory as tc on tc.TrcatCode=wf.Category
where WorkforceId in(select WorkforceId from workforce_attendance)) mstr_workforce
PIVOT (count(Tradecat) FOR Tradecat IN ('+@column+')) AS pvt'
EXECUTE (@query)
select COUNT(wa.AttendanceDate)as totalpresent from workforce_attendance as wa
inner join mstr_workforce as wf on wa.WorkforceID=wf.WorkforceId
where AttendanceDate='05-12-2015' group by wf.PermanentState
 
 
 
i am used above stored procedure

Answers (1)