Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6737521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:15:31+00:00 2026-05-26T11:15:31+00:00

So Postgres is complaining about: PGError: ERROR: column sessions.created_at must appear in the GROUP

  • 0

So Postgres is complaining about:

PGError: ERROR:  column "sessions.created_at" must appear in the GROUP BY clause or be used in an aggregate function

But the trouble is, “created_at” does appear in the group by clause:

SELECT     created_at, count(id) as visit_count FROM       "sessions"  WHERE     ("sessions"."site_id" IN (4, 3)) AND ("sessions"."created_at" >= '2011-10-20 00:00:00.000000') AND ("sessions"."created_at" <= '2011-10-27 23:59:59.999999') GROUP BY  date(created_at))

Does it have something to do with created_at being wrapped in date() perhaps?

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:15:32+00:00Added an answer on May 26, 2026 at 11:15 am

    No, it does not appear.

    The GROUP BY contains date(created_at) whereas your SELECT list only contains created_at. If created_at is a timestamp, then these are two different things.

    You either need to use GROUPY BY created_at or SELECT date(created_at) (probably the latter)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a Postgres 8.4 database that contains a varchar(10000) column. I'd like
I'm using postgres and I'm getting the duplicate key error when updating a row:
I have two Postgres databases. In one I have two tables, each with about
In postgres there is a built in function generate_series() which can generate rows with
I have a postgres function that returns two columns result, data (int), (text) If
Simple rails app using Postgres DB, getting 'integer out of range' error when trying
I need a Postgres function to return a virtual table (like in Oracle) with
Lets say I have two tables in Postgres: Name: table_rad Column Type id integer
Postgres can round (truncate) timestamps using the date_trunc function, like this: date_trunc('hour', val) date_trunc('minute',
Using Postgres. I have users, which have items. Items have a column type. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.