三张表关联查询(原生sql,任何关系型数据库都可以用)

三张表:merchant_area,sys_area,merchant.

SELECT a.id AS "id",

a.merchant_name AS "merchantName",
a.merchant_type AS "merchantType",
a.create_time AS "createTime",
a.is_delete AS "isDelete",
c.id AS 'area.id',
c.name AS 'area.name'
FROM merchant a 
LEFT JOIN merchant_area b ON b.`merchant_id` = a.`id` 
LEFT JOIN sys_area c ON c.`id`=b.`area_id`
阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/JavaMk/article/details/50879020
个人分类: Mysql
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭