sql server - How to convert multiple join associated with aggregate function Linq to sql C#? -


i want write following query using linq sql ? tried , i'm beginner in linq , got lost in , please or tips articles can figure out ??

select (s.fname + '' + s.lname ) doctor_name  , appointment_id , [date/time] , price , type ,                                                                                                                                            patient_id staff s , (select  appointment_id,[date/time] , price , apptype.type , patient_id , [doctor-id]       appointmenttype apptype , (  select *  appointments app app.appointment_id =  (     select max(appointment_id) lastapp     appointments app1     app1.patient_id = app.patient_id , app.patient_id=10 )  ) rr apptype.id = rr.type ) dd dd.[doctor-id] = s.id 

any tips please , way :)

                using (dataclasses1datacontext db = new dataclasses1datacontext())                 {                       var x = apptype in db.appointmenttypes                                     rr in (                                         (from app in db.appointments                                                                                       app.appointment_id ==                                              (from app1 in db.appointments                                                                                             app1.patient_id == app.patient_id &&                                               app.patient_id == patient.patient_id                                             select new {                                               app1.appointment_id                                             }).max(p => p.appointment_id)                                         select new {                                           app                                         }))                                                                   apptype.id == rr.app.type                                     select new {                                         apptype.id,                                    //   apptype.appointment_id,                                     ///// take ***  column1 =  rr.app.date_time ,                                       apptype.price,                                       apptype.type,                                       rr.app.patient_id      //   apptype.patient_id,                                      // column2 = (apptype.doctor - apptype.id)                                     }; 

Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -