简体   繁体   English

#1241-操作数应包含phpmyadmin上的1列

[英]#1241 - Operand should contain 1 column(s) In wamp on phpmyadmin

Nested query in Sql. 在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). 操作数应包含1列。

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. 我不知道为什么你试图返回supplier_sign_up_id从子查询。 You know the value is 42. I suspect you just want email_address . 您知道值是42。我怀疑您只想要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;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM