title: Convert string to decimal in group join linq query
body: <p>I have to join two tables but to return only those records in second table where sum of 'Value' of all records associated with the record in first table is the same.</p>
  
  <pre><code>from p in db.TPs
  join n in db.TNs
  on p.Key equals n.Key
  where (decimal.Parse(p.Value) == db.TNs.Where( nn =&gt; nn.Key == p.Key )
                                         .Sum( nn=&gt; decimal.Parse(kk.Value)))
  </code></pre>
  
  <p>I'm using Entity Framework Code-First.</p>
  
  <p>Of course, Linq complains </p>
  
  <blockquote>
    <p>LINQ to Entities does not recognize the method 'System.Decimal
    Parse(System.String)' method</p>
  </blockquote>
  
  <p>Tables are huge and I must reduce output, so doing this conversion on the client side is not possible. Column type conversion is also not an option.</p>
  
  <p>The SQL query is:</p>
  
  <pre><code>select * from TP as p
  join * from TN as n on n.Key = p.Key
  where p.Value = (select sum(cast(n.Value as decimal(12,2))) from TN where Key = p.Key)
  </code></pre>