ConverseST_Cmt
CvsCmtID Content Display DelEmployeeID DelTime
内容 是否删除 删除人 删除时间
ConverseST_Reply
ReID CvsCmtID RePlyContent Display DelEmpLoyeeID DelTime CrTime
问题id 回覆内容 是否删除 删除人 删除时间 创建时间
Member 表
MemberID RealName
人员ID 名字
根据回覆创建时间取出每一个问题的最新回覆。取出内容为 Question.id , (如果 stues为真, 取出 Question.Content+Question.DelEmployeeID,否则取出Question.Content),Replay.RePlyContent 也就是取出group by question 每一组的每一条内容!这是别人给的句子改动之后的SQL
select a.CvsCmtID,
问题=case a.Display when '真' then a.Content+ c.RealName else a.Content end,
b.RePlyContent
from ConverseST_Cmt a,
ConverseST_Reply b,
dbo.Member c
where a.CvsCmtID=b.CvsCmtID and a.DelStoMbrID =c.MemberID and a.CvsID='45B738C1-FFE8-4CFC-BE23-E191B23EA4AB' and not exists(select 1 from ConverseST_Reply where CvsCmtID=b.CvsCmtID and CrTime>b.CrTime)
我的表中所有创建时间是同一个时间,这条语句就会进入死循环,想用top又不知道该怎么加上去。
CvsCmtID Content Display DelEmployeeID DelTime
内容 是否删除 删除人 删除时间
ConverseST_Reply
ReID CvsCmtID RePlyContent Display DelEmpLoyeeID DelTime CrTime
问题id 回覆内容 是否删除 删除人 删除时间 创建时间
Member 表
MemberID RealName
人员ID 名字
根据回覆创建时间取出每一个问题的最新回覆。取出内容为 Question.id , (如果 stues为真, 取出 Question.Content+Question.DelEmployeeID,否则取出Question.Content),Replay.RePlyContent 也就是取出group by question 每一组的每一条内容!这是别人给的句子改动之后的SQL
select a.CvsCmtID,
问题=case a.Display when '真' then a.Content+ c.RealName else a.Content end,
b.RePlyContent
from ConverseST_Cmt a,
ConverseST_Reply b,
dbo.Member c
where a.CvsCmtID=b.CvsCmtID and a.DelStoMbrID =c.MemberID and a.CvsID='45B738C1-FFE8-4CFC-BE23-E191B23EA4AB' and not exists(select 1 from ConverseST_Reply where CvsCmtID=b.CvsCmtID and CrTime>b.CrTime)
我的表中所有创建时间是同一个时间,这条语句就会进入死循环,想用top又不知道该怎么加上去。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货