SQL Server: Operand should contain 1 column(s) [closed]











up vote
0
down vote

favorite












I am trying to aggregate the shopping_time field in a table. Does anyone know why I would be getting the error:




Operand should contain 1 column(s)




My table has customer_id, household_id, month, year, grocery_store, shopping_time.



select 
u.customer_id, u.household_id, u.month, u.year, u.grocery_store,
SUM(u.shopping_time)
from
usage_counters_monthly u
group by
(u.customer_id, u.household_id, u.month, u.year, u.grocery_store)









share|improve this question















closed as off-topic by Salman A, Alejandro, pushkin, Larnu, lagom Nov 20 at 3:32


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – Salman A, Alejandro, pushkin, Larnu, lagom

If this question can be reworded to fit the rules in the help center, please edit the question.













  • Jusr remove the brackets in the group by clause
    – Salman A
    Nov 19 at 19:48










  • thank you! solved.
    – Shabina Rayan
    Nov 19 at 19:48















up vote
0
down vote

favorite












I am trying to aggregate the shopping_time field in a table. Does anyone know why I would be getting the error:




Operand should contain 1 column(s)




My table has customer_id, household_id, month, year, grocery_store, shopping_time.



select 
u.customer_id, u.household_id, u.month, u.year, u.grocery_store,
SUM(u.shopping_time)
from
usage_counters_monthly u
group by
(u.customer_id, u.household_id, u.month, u.year, u.grocery_store)









share|improve this question















closed as off-topic by Salman A, Alejandro, pushkin, Larnu, lagom Nov 20 at 3:32


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – Salman A, Alejandro, pushkin, Larnu, lagom

If this question can be reworded to fit the rules in the help center, please edit the question.













  • Jusr remove the brackets in the group by clause
    – Salman A
    Nov 19 at 19:48










  • thank you! solved.
    – Shabina Rayan
    Nov 19 at 19:48













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am trying to aggregate the shopping_time field in a table. Does anyone know why I would be getting the error:




Operand should contain 1 column(s)




My table has customer_id, household_id, month, year, grocery_store, shopping_time.



select 
u.customer_id, u.household_id, u.month, u.year, u.grocery_store,
SUM(u.shopping_time)
from
usage_counters_monthly u
group by
(u.customer_id, u.household_id, u.month, u.year, u.grocery_store)









share|improve this question















I am trying to aggregate the shopping_time field in a table. Does anyone know why I would be getting the error:




Operand should contain 1 column(s)




My table has customer_id, household_id, month, year, grocery_store, shopping_time.



select 
u.customer_id, u.household_id, u.month, u.year, u.grocery_store,
SUM(u.shopping_time)
from
usage_counters_monthly u
group by
(u.customer_id, u.household_id, u.month, u.year, u.grocery_store)






sql-server aggregate






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 at 20:36









marc_s

569k12811001250




569k12811001250










asked Nov 19 at 19:47









Shabina Rayan

468




468




closed as off-topic by Salman A, Alejandro, pushkin, Larnu, lagom Nov 20 at 3:32


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – Salman A, Alejandro, pushkin, Larnu, lagom

If this question can be reworded to fit the rules in the help center, please edit the question.




closed as off-topic by Salman A, Alejandro, pushkin, Larnu, lagom Nov 20 at 3:32


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – Salman A, Alejandro, pushkin, Larnu, lagom

If this question can be reworded to fit the rules in the help center, please edit the question.












  • Jusr remove the brackets in the group by clause
    – Salman A
    Nov 19 at 19:48










  • thank you! solved.
    – Shabina Rayan
    Nov 19 at 19:48


















  • Jusr remove the brackets in the group by clause
    – Salman A
    Nov 19 at 19:48










  • thank you! solved.
    – Shabina Rayan
    Nov 19 at 19:48
















Jusr remove the brackets in the group by clause
– Salman A
Nov 19 at 19:48




Jusr remove the brackets in the group by clause
– Salman A
Nov 19 at 19:48












thank you! solved.
– Shabina Rayan
Nov 19 at 19:48




thank you! solved.
– Shabina Rayan
Nov 19 at 19:48












1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










Remove the parentheses in the group by:



select u.customer_id, u.household_id, u.month, u.year, u.grocery_store, SUM(u.shopping_time)
from usage_counters_monthly u
group by u.customer_id, u.household_id, u.month, u.year, u.grocery_store;


In many databases, this would be an error. However, some databases support tuples. In these databases, you have an inconsistency between the select and the group by, which would be causing your error.






share|improve this answer




























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote



    accepted










    Remove the parentheses in the group by:



    select u.customer_id, u.household_id, u.month, u.year, u.grocery_store, SUM(u.shopping_time)
    from usage_counters_monthly u
    group by u.customer_id, u.household_id, u.month, u.year, u.grocery_store;


    In many databases, this would be an error. However, some databases support tuples. In these databases, you have an inconsistency between the select and the group by, which would be causing your error.






    share|improve this answer

























      up vote
      0
      down vote



      accepted










      Remove the parentheses in the group by:



      select u.customer_id, u.household_id, u.month, u.year, u.grocery_store, SUM(u.shopping_time)
      from usage_counters_monthly u
      group by u.customer_id, u.household_id, u.month, u.year, u.grocery_store;


      In many databases, this would be an error. However, some databases support tuples. In these databases, you have an inconsistency between the select and the group by, which would be causing your error.






      share|improve this answer























        up vote
        0
        down vote



        accepted







        up vote
        0
        down vote



        accepted






        Remove the parentheses in the group by:



        select u.customer_id, u.household_id, u.month, u.year, u.grocery_store, SUM(u.shopping_time)
        from usage_counters_monthly u
        group by u.customer_id, u.household_id, u.month, u.year, u.grocery_store;


        In many databases, this would be an error. However, some databases support tuples. In these databases, you have an inconsistency between the select and the group by, which would be causing your error.






        share|improve this answer












        Remove the parentheses in the group by:



        select u.customer_id, u.household_id, u.month, u.year, u.grocery_store, SUM(u.shopping_time)
        from usage_counters_monthly u
        group by u.customer_id, u.household_id, u.month, u.year, u.grocery_store;


        In many databases, this would be an error. However, some databases support tuples. In these databases, you have an inconsistency between the select and the group by, which would be causing your error.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 19 at 19:51









        Gordon Linoff

        754k35289397




        754k35289397















            Popular posts from this blog

            "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

            Alcedinidae

            Origin of the phrase “under your belt”?