I'm trying to fetch some data using only one query. I need to fetch one shop, which can have several modules (or possibly none), for each module I need one record in modules to exist.
My problem is getting all shop_modules enabled except just the first one? Is this possible without splitting it in two queries?
Thanks in advance
$sql = "
SELECT
s.*, sm.config, m.internal_name
FROM shops s
LEFT JOIN shop_modules sm ON sm.shop_id = s.id
INNER JOIN modules m ON m.id = sm.module_id WHERE s.domain = ?";
$shop = $app['db']->fetchAssoc($sql, array($subdomain));
我在另一个网站上找到了类似问题的答案:“ 数据库查询会产生一个结果集,就像一个平面文件一样-它具有行和列 ”-例如,我要问的是在不拆分查询的情况下是不可能的成两半!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.