【发布时间】:2014-05-29 22:53:14
【问题描述】:
我想使用 Linq to sql 编写以下查询? 我试着去做,但我是 Linq 的初学者,我迷失了,请任何帮助或任何有助于解决这个问题的文章提示?
select (s.fname + '' + s.lname ) as doctor_name , appointment_id , [date/time] , price , type ,
patient_id
from staff s
,
(select appointment_id,[date/time] , price , apptype.type , patient_id , [doctor-id] from
AppointmentType apptype ,
( select *
from Appointments app
where app.appointment_id =
(
select Max(appointment_id) as lastApp
from Appointments app1
where app1.patient_id = app.patient_id and app.patient_id=10
)
) as rr
where apptype.id = rr.type
) as dd
where dd.[doctor-id] = s.id
请给点建议,谢谢 :)
【问题讨论】:
-
你能告诉我们你到目前为止写的代码吗?至少我们会知道你的实体的名称和属性......
标签: c# sql-server linq linq-to-sql linq-to-objects