title: Sql Pivot table with three cross tab and multiple columns dynamically
body: <p>I have the following table with values as</p>
  <pre><code>CREATE TABLE stud 
    ( 
       sname NVARCHAR(10), 
       hr    NVARCHAR(30), 
       dt    DATETIME, 
       att   VARCHAR(3) 
    )
  
  INSERT INTO stud VALUES ('Abi',  '1',  '21/01/2013','a')
  INSERT INTO stud VALUES ('Abi',  '2',  '21/01/2013','p')
  INSERT INTO stud VALUES ('bala',  '1',  '21/01/2013','p')
  INSERT INTO stud VALUES ('bala',  '2',  '21/01/2013','a')
  INSERT INTO stud VALUES ('bala',  '1',  '22/01/2013','od')
  INSERT INTO stud VALUES ('bala',  '2',  '22/01/2013','ml')
  INSERT INTO stud VALUES ('Abi',  '1',  '22/01/2013','ml')
  INSERT INTO stud VALUES ('Abi',  '2',  '22/01/2013','od')
  </code></pre>
  <p>If i select this table i get the output as</p>
  <pre><code>SELECT * 
  FROM   stud 
  </code></pre>
  <pre>sname   hr            dt                att
  Abi 1   2013-01-21 00:00:00.000  a
  Abi 2   2013-01-21 00:00:00.000  p
  bala    1   2013-01-21 00:00:00.000  p
  bala    2   2013-01-21 00:00:00.000  a
  bala    1   2013-01-22 00:00:00.000  od
  bala    2   2013-01-22 00:00:00.000  ml
  Abi 1   2013-01-22 00:00:00.000  ml
  Abi 2   2013-01-22 00:00:00.000  od</pre>
  <p>but I want the output as follows in crystal report in ASP.NET ( Note : the date should given as dynamically as <strong>from_date</strong> to <strong>to to_date</strong> )</p>
  <img src="https://i.stack.imgur.com/C9iau.gif" />
  <p><code>sname          21/01/2013              22/01/2013</code></p>
  <p>I tried for this output from long days itself, but didn't get output.</p>