KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ Error with sum

  • Error with sum

    Posted by nvadithya on July 30, 2022 at 12:00 am

    I’m trying aggregate the consumption values which are of type long int, by the meter id which I’ve stored as int too. But I’m getting an empty table when I run the command in the screenshot. Any idea on how I can fix this?

     

     

    You are awesome!

    Thank you!

    nvadithya replied 8 months, 1 week ago 3 Members · 2 Replies
  • 2 Replies
  • denakaran

    Member
    July 31, 2022 at 12:00 am

    Hi, i think it is because of the value column which is a keyword in q.. I just renamed v in uppercase(V) and it is working. After aggregation i think you can rename it again with value using xcol.

  • davidcrossey

    Member
    July 31, 2022 at 12:00 am

    Hi navdithya,

    Your query is selecting the value (.:) function by mid. You need to apply sum on a column by mid to get an aggregation e.g.

     

    show t:select sum column by mid from readings

     

    Kind regards,

    David

Log in to reply.