mysql like查询店铺和商品
店铺
商品
mysql
like
查询
id
store
FROM
SELECT
WHERE
编程技术
发布日期
2022-12-07
更新日期
2023-02-13
阅读次数 88
文章字数 219
如果店铺名称匹配,或商品名称匹配
SELECT 'store' AS 'sql',`id` FROM `store` WHERE id IN ( SELECT `id` FROM `store` WHERE `title` LIKE '%滴%' )
UNION ALL
SELECT 'good' AS 'sql', `id` FROM `store` WHERE id NOT IN ( SELECT `id` FROM `store` WHERE `title` LIKE '%滴%' ) AND id IN ( SELECT DISTINCT `sid` 'id' FROM `product` WHERE `title` LIKE '%滴%' )
文章作者: 朱丰华
文章链接: https://smart.52dixiaowo.com/blog/post-223.html
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。
店铺
商品
mysql
like
查询
id
store
FROM
SELECT
WHERE
发表评论
相关推荐