sql连表查询语句

select * from message,reply where message.Id=reply.MsId
查询两张表(message.Id=reply.MsId)的内容

两个表:

select message.*,reply.RpContent  from message left join reply on  message.Id = reply.MsId
查询message表全部内容 和 reply表(message.Id = reply.MsId)的内容

三个表:

SELECT subshop. * , coupon. * , color. *
FROM subshop
LEFT JOIN coupon ON subshop.Id = coupon.ShopId
LEFT JOIN color ON coupon.ColorId = color.ColorId

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注