sql 查询一张表中相同orderid的两条记录 显示为一条内容为全部内容
发布网友
发布时间:2022-04-30 18:52
我来回答
共1个回答
热心网友
时间:2023-10-09 14:38
select c.commentid,c.orderid,c.fromuserid,u1.name,u1.contet,u2.name,u2.content
from common c join user u
on c.fromuserid=u.userid
join user u1
on c.fromuserid=u1.userid
where exists (select 1 from comment m
where c.commentid<>m.commentid
and c.orderid=m.orderid)