#1241 - Operand should contain 1 column(s)

后端 未结 2 1254
春和景丽
春和景丽 2021-01-25 05:35

In the following query am trying to get one image per category

SELECT  l.*
FROM    (
   SELECT  id AS category_id,
           COALESCE(
           (
           S         


        
相关标签:
2条回答
  • 2021-01-25 06:11

    replace * with a single column for images li

    0 讨论(0)
  • 2021-01-25 06:14

    I had a similar problem. Your 3rd level select statement (SELECT * FROM images li) needs to return a single value, since the 2nd level select statement (SELECT id AS category_id,COALESCE( ...) is expecting only one value in its place holder.

    For my case, it worked. Here I also averaged the data from a second based table (SecondBasis) to the values in the one minute basis table (MinuteBasis):

    SELECT MinuteBasis.time, MinuteBasis.avg_t, MinuteBasis.avg_p,MinuteBasis.avg_t2,
      (SELECT avg(SecondBasis.m1)
       FROM SecondBasis
       WHERE SecondBasis.time BETWEEN MinuteBasis.time AND addtime (MinuteBasis.time,'0 0:00:59'))
      (SELECT avg(SecondBasis.m2)
       FROM SecondBasis
       WHERE SecondBasis.time BETWEEN MinuteBasis.time AND addtime (MinutBasis.time,'0 0:00:59'))
    FROM MinuteBasis
    WHERE MinuteBasis.time BETWEEN '2012-05-02 8:30:00' AND '2012-05-02 8:44:59' ;
    
    0 讨论(0)
提交回复
热议问题