Nested query in Sql.
SELECT
*,
(SELECT `supplier_sign_up_id`,
(
SELECT
email_address
FROM
supplier_sign_up
WHERE
supplier_sign_up_id = 42 LIMIT 1
)
FROM
`suppliers_acc`
WHERE
singup_login_id = 138 LIMIT 1
)
FROM
`singup_login`
WHERE
1;
It's give error-
Operand should contain 1 column(s).
How to resolve it.
Perhaps this does what you want:
SELECT sa.*,
(SELECT ssu.email_address
FROM supplier_sign_up ssu
WHERE ssu.supplier_sign_up_id = 42
LIMIT 1
)
FROM suppliers_acc sa
WHERE sa.singup_login_id = 138;
I'm not sure why you are trying to return supplier_sign_up_id
from the subquery. You know the value is 42. I suspect you just want email_address
.
Try This ,
SELECT *,
(SELECT `supplier_sign_up_id` FROM suppliers_acc WHERE singup_login_id = 138 LIMIT 1) as supplier_sign_up_id ,
(SELECT `email_address` FROM supplier_sign_up WHERE supplier_sign_up_id = 42 LIMIT 1 ) as email_address
FROM
`singup_login`
WHERE
1;
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.