title: LINQ Complex Query
body: <p>I have a complex SQL query which I need to run in LINQ. I'm wondering is it possible to do it with LINQ, or do I need anything else? Could you please help me? Thanks.</p>
  
  <pre><code>SELECT DISTINCT_PLAY_COUNT,SUM(1) AS CLIENT_COUNT FROM
      (SELECT CLIENT_ID,SUM(1) AS DISTINCT_PLAY_COUNT FROM
          (SELECT CLIENT_ID,SONG_ID FROM PIEXHIBIT 
          WHERE PLAY_TS &gt;= '10/08/2016 00:00:00' AND PLAY_TS &lt;= '10/08/2016 23:59:59'
          GROUP BY CLIENT_ID,SONG_ID
      )
      GROUP BY CLIENT_ID
  )
  GROUP BY DISTINCT_PLAY_COUNT 
  </code></pre>
  
  <p>Here is my class for it and what I accomplished so far;</p>
  
  <pre><code>    public class Exhibit
      {
          public string PLAY_ID { get; set; }
          public Int32 SONG_ID { get; set; }
          public Int32 CLIENT_ID { get; set; }
          public DateTime PLAY_TS { get; set; }
  
      }
  
      var sql = from Exhibit row in Exhibit
                                where row.PLAY_TS &gt;= DateTime.Parse("10/08/2016 00:00:00") &amp;&amp; row.PLAY_TS &lt;= DateTime.Parse("10/08/2016 23:59:59")
                                select new { row.CLIENT_ID, row.SONG_ID };
  </code></pre>