凌寒飘香

____成风破浪会有时,直把云帆济沧海!

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: :: 管理 ::
 select distinct a.PatientID,a.PatientCode,a.PatientSex,a.MobileNo,a.HomePhoneNo,a.UserAge,a.PatientName,a.PatientIDCard,  DATE_FORMAT(a.RegistDate,'%Y-%m-%d') as RegistDate, 
 case  when b.usedstartTime is not null and b.UsedEndTime is null then '1'
when b.usedstartTime is not null and b.UsedEndTime is not  null then '2'
 end  as 'usedState'
 from mets_v_patient_baseinfo  a
 
 left join mets_devices_used_history b on a.patientid = b.PatientID
 
 where   (select ifnull(IsDeleted,0) from userpublic_info where UserID = a.PatientID ) = 0
 and  1=1 
 order by PatientID Desc limit 0,15
posted on 2010-07-08 17:01  凌寒飘香  阅读(23363)  评论(1编辑  收藏  举报