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 277061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T01:00:58+00:00 2026-05-12T01:00:58+00:00

Right, another question on queries (there must be a syntax guide more helpful than

  • 0

Right, another question on queries (there must be a syntax guide more helpful than mySQL’s manual, surely?)

I have this query (from another helpful answer on SO)…

SELECT DATE_FORMAT(`when`, '%e_%c_%Y')date, COUNT(`ip`) AddressCount FROM `Metrics` WHERE `ID` = '1' GROUP BY DATE(`when`)

I now want to do a similar query to get unique/distinct results for the IPs… i.e. unique visitors per date. My query was this…

SELECT DATE_FORMAT(`when`, '%e_%c_%Y')date, COUNT(distinct `ip`) AddressCount FROM `Metrics` WHERE `ID` = '1' GROUP BY DATE(`when`)

However, that returns a repetition of dates, though different quantities of Addresscount…

date    AddressCount
29_6_2009   1
30_6_2009   1
29_6_2009   1
30_6_2009   1
29_6_2009   1
NULL    1
15_5_2009   1
14_5_2009   2
NULL    3
14_5_2009   4
15_5_2009   1
26_6_2009   1
29_6_2009   1
26_6_2009   1
15_5_2009   1
26_6_2009   1
29_6_2009   1

Any ideas on where I’m going wrong?

  • 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-12T01:00:58+00:00Added an answer on May 12, 2026 at 1:00 am

    Your group by will need to match the data you’re selecting, so this should work:

    SELECT DATE_FORMAT(`when`, '%e_%c_%Y')date, COUNT(distinct `ip`) AddressCount FROM `Metrics` WHERE `ID` = '1' GROUP BY date
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right, initially ran: c:\regsvr32 Amazing.dll then, (accidentally - I might add) I must have
another request sorry.. Right now I am reading the tokens in one by one
I seem right now to be embroiled in a debate with another programmer on
Right now I have a database (about 2-3 GB) in PostgreSQL, which serves as
Ok so I think I must be misunderstanding something about SQL queries. This is
We are having another discussion here at work about using parametrized sql queries in
I'm working on code that does nearest-neighbor queries. There are two simple ideas that
I have a question about relationships between two tables. Let's say we have a
Right now, I keep all of my projects on my laptop. I'm thinking that
Right now, I'm particularly interested in reading the data from MP3 files (ID3 tags?),

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.