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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:11:15+00:00 2026-06-11T05:11:15+00:00

I’m atm seeing a strange behaviour in a sql request. My table pointLog: #

  • 0

I’m atm seeing a strange behaviour in a sql request.

My table pointLog:

# Column Type
1 date timestamp
2 uid varchar(30)
3 ssid varchar(40)
4 reason varchar(50)
5 points int(5) No None

The statement:

SELECT date, count(date) as anzahl FROM pointLog WHERE uid = 1 order by date desc 

returns following result

    date                anzahl
2012-09-01 12:21:16     14

But the statement:

SELECT date FROM pointLog WHERE uid = 1 order by date desc 

Returns

2012-09-02 12:44:08

as first result.

So my question: why I’m not receiving the 2012-09-02 as first result in the first statement which includes a count ??

Thanks a lot!

edit
The count as anzahl is atm only used to verify that there are more than 0 entries in this example. I know its should be tested in the programm.

But my main problem is, that I can’t explain, why I’m getting 2 different dates when it’s sorted by the same (date). So the only difference is the count attribute. But that shouldn’t normally change the sorting?

FINAL* The solution

SELECT MAX(date) AS maxdate, COUNT(date) AS anzahl FROM pointLog WHERE uid = 1
  • 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-06-11T05:11:17+00:00Added an answer on June 11, 2026 at 5:11 am

    As @prosfilaes answered, your query does not return deterministic results, the date returned in an arbitrary one.

    If you want the latest date and the count, you can use:

    SELECT 
        MAX(date) AS maxdate, 
        COUNT(date) AS anzahl 
    FROM 
        pointLog 
    WHERE 
        uid = 1 ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a view passing on information from a database: def serve_article(request, id): served_article
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text

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.