我有两个名为 OFFICE_GROUP 和 OFFICE_IPS 的表,
我想得到像得到 4 行这样的结果:
使用的查询是这样的:
SELECT (SELECT oip.IP as IP FROM OFFICE_IPS oip, OFFICE_GROUP og WHERE og.OFFICE_GROUP_ID = oip.OFFICE_GROUP_ID
AND og.MODULES like '%1%' lIMIT 1) AS SEMINAR,
(SELECT oip.IP as IP FROM OFFICE_IPS oip, OFFICE_GROUP og WHERE og.OFFICE_GROUP_ID = oip.OFFICE_GROUP_ID
AND og.MODULES like '%2%' lIMIT 1) AS FAQ,
(SELECT oip.IP as IP FROM OFFICE_IPS oip, OFFICE_GROUP og WHERE og.OFFICE_GROUP_ID = oip.OFFICE_GROUP_ID
AND og.GRP_LIMIT like '%1%' lIMIT 1) AS DEV_MODE,
(SELECT oip.IP as IP FROM OFFICE_IPS oip, OFFICE_GROUP og WHERE og.OFFICE_GROUP_ID = oip.OFFICE_GROUP_ID
AND og.GRP_LIMIT like '%2%' lIMIT 1) AS META_API,
(SELECT oip.IP as IP FROM OFFICE_IPS oip, OFFICE_GROUP og WHERE og.OFFICE_GROUP_ID = oip.OFFICE_GROUP_ID
AND og.GRP_LIMIT like '%3%' lIMIT 1) AS TRADING_SIGNAL
但是如果我想获得多行,我的意思是如果子查询返回多行。
在上面的查询中,如果我删除 '...LIMIT 1' 然后,得到像 #1242 这样的错误 - 子查询返回超过 1 行
任何人,请帮助我。