Hi, I need to extract data from multiple rows of the same ID from one table.
The Student Table:
ID | FName | LName ======================== 1 | ABC | XYZ 2 | MNA | PQR
Program Table
ID | Program ============== 1 | Program1 2 | Program2
and StudentQualif Table
ID | Std_ref_id | Program_ref_id | Marks ============================================= 1 | 1 | 1 | 890 2 | 1 | 2 | 970
and Need to Extract Data like this:
Name | LName | Program1Marks | program2Marks ================================================ abc | xyz | 890 | 970
Here is my query:
which fetches the student detail from the table with program1 marks how can I get program2 marks?
var query = (from d in db.tblStdDetail
join a in db.tblStudentQualif on d.ID equals a.Std_ref_id
join p in db.tblProgram on a.Program_ref_id equals p.ID
where p.ID = 1
select new {
d.Name, d.FName, p.Marks
});