ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Convert Rows into Columns in SQL Server<p>Find this&nbsp;solution&nbsp;</p> <p>&nbsp;</p> <pre class="brush: sql">create table #temp (dDateTime Datetime, sStatus varchar(20), sEmpId varchar(20)) insert into #temp values (&#39;2018-05-28 8:00&#39;, &#39;s1&#39;, &#39;2000347&#39;) insert into #temp values (&#39;2018-05-28 20:18&#39;, &#39;s2&#39;, &#39;2000347&#39;) insert into #temp values (&#39;2018-05-28 8:00&#39;, &#39;s1&#39;, &#39;2000348&#39;) insert into #temp values (&#39;2018-05-28 17:18&#39;, &#39;s2&#39;, &#39;2000348&#39;) --select * from #temp select sEmpId, s1 as &#39;INOUT (1)INTime&#39;, s2 as &#39;INOUT(2)OutTime&#39; from ( select * from #temp ) d pivot ( max(dDateTime) for sStatus in (s1,s2) ) piv; drop table #temp</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/200492/Convert-Rows-into-Columns-in-SQL-Server/https://www.aspforums.net:443/Threads/200492/Convert-Rows-into-Columns-in-SQL-Server/Sun, 16 Dec 2018 23:30:28 GMT