Why do I need a Group By?

Moderator: NorbertKrupa

Post Reply
User avatar
Julie
Master
Master
Posts: 221
Joined: Thu Apr 19, 2012 9:29 pm

Why do I need a Group By?

Post by Julie » Mon Jul 22, 2013 8:34 pm

Hello,

Can someone take a gander at the following SQL and please let me know why I am getting the error?

Code: Select all

dbadmin=> select min(time) from dc_netstats where node_name = 'v_mydb_node0001' and udp_in_errors <> 0 order by time;
ERROR 2640:  Column "dc_netstats.time" must appear in the GROUP BY clause or be used in an aggregate function
Thanks,
Juliette

scutter
Master
Master
Posts: 302
Joined: Tue Aug 07, 2012 2:15 am

Re: Why do I need a Group By?

Post by scutter » Mon Jul 22, 2013 10:00 pm

The error message is a bit obscure, but you're only selecting min(time) which is a single value. You can't then order by time.
Sharon Cutter
Vertica Consultant, Zazz Technologies LLC

Post Reply

Return to “Vertica SQL”