Note that there are some explanatory texts on larger screens.

plurals
  1. PORunning Total ASP.NET MVC and Linq to SQL
    primarykey
    data
    text
    <p>I am using ASP.NET MVC2, SQLServer. I have 3 tables in my Database.</p> <p>From <code>tblPerson</code> I am interested only in the <code>PersonID</code> field. <code>tblPerson[PID(pk),PName]</code></p> <pre><code>PID------------PName 12-------------AAA 13-------------BBB </code></pre> <p><code>tblPHrs</code> has the following schema: <code>tblPHrs[PId(pk),Semester(pk),Hrs]</code></p> <pre><code>PID---------------Semester-----------Hrs 12----------------SS2011----------18 12----------------WS2012----------20 13----------------WS2011----------20 14----------------SS2012----------18 </code></pre> <p><code>tblCHrs</code> has the following schema: <code>tblCHrs[CourseId(pk), PId(pk),Semester(pk), Whrs, UL, UT]</code> here <code>WHrs</code>, <code>UL</code> and <code>UT</code> all are numeric field</p> <pre><code>CourseID-----------PId-----------Semester------WHrs----UL------UT 77-----------------12------------SS2011--------10------2-------1 78-----------------12------------SS2011--------4-------1-------2 79-----------------12------------SS2012--------24------4-------2 77-----------------12------------WS2012--------16------2-------2 77-----------------13------------SS2011--------4-------2-------2 </code></pre> <p>Now I want to return this kind of result using LINQ to SQL by passing <code>PID</code> as a parameter for example <code>PID = 12</code></p> <pre><code>Semester---PId--Hrs(from tblPhrs)--Acutal(tblChrs-&gt;summing(Whrs+UL+UT)--Gap--RngTotal SS2011-----12---18-----------------20-----------------------------------2----0 SS2012-----12---20-----------------20-----------------------------------0----2 </code></pre> <p>I'm using LinqToSQL, any idea how can I construct such query? </p>
    singulars
    1. This table or related slice is empty.
    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.
 

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