Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your question is not very clear - I don't understand whether idx is in Table3 or Table1, and what you want to select, but I will assume you have a many-one-many schema, where an <code>Investor</code> has zero or more <code>Loans</code> &amp; zero or more <code>InvestorInfos</code>. You want to get, say, all of the loans which join to investor info with <code>idx = 2005</code>. Correct me if I'm wrong, and correct your question if I'm right!</p> <p>Starting with your <code>InvestorInfo</code> object, you know that there's only one <code>Investor</code> but there will be zero or more <code>Loans</code>.</p> <pre><code>// only one InvestorInfo for idx, but this isn't clear in your question var investorInfo = context.InvestorInfos.SingleOrDefault(i =&gt; i.idx == 2005); var loans = investorInfo.Investor.Loans; </code></pre> <p>The crux of your problem is that you cannot get 'the loan service fee' for an investor info. Why not? Because that investor has 5 loans. Which one do you want?</p> <pre><code>-- we can get the maximum, minimum, sum, etc... var max = loans.Max(l =&gt; l.DT_REAL_PERC_VALUE); var min = loans.Min(l =&gt; l.DT_REAL_PERC_VALUE); var min = loans.Sum(l =&gt; l.DT_REAL_PERC_VALUE); </code></pre> <p>Again it's not clear what you are trying to do, nor what your data actually looks like, but in a one-many relationship you will necessarily have more than one of the 'many' side for each of the 'one' side.</p> <hr> <p>To get the max, use the <code>Max</code> operator.</p> <pre><code>service_fee = grp.Max(l =&gt; l.Table2.Table3.Max(t =&gt; t.DT_REAL_PERC_VALUE)) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload