22,209
社区成员
发帖
与我相关
我的任务
分享
select distinct * from
(a.ID,a.sex,a.NickName,a.Work_location,a.Birth,a.Height,a.Home_location,a.Income,a.Marriage,a.Industry,a.Education from UserPhoto b ,UserBase a left join ZhiJianPaiMing c
on a.id=c.userid and getdate()> c.starttime and getdate() <c.endtime where a.ID=B.UserID and a.Sex =1 Order By case when c.id is null then 1 else 0 end,a.addTime ) t