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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:10:32+00:00 2026-06-13T17:10:32+00:00

The main problem is, that I have stored in database datetime , not the

  • 0

The main problem is, that I have stored in database datetime , not the date (what I need). Ok never mind.

I have thousands of reports stored each day.

I need to LEFT by 10 my datetime_view (to cut the time) and everything’s fine. Except this. I’m trying to figure out why do I have to put in the condition + one day from the future? Otherwise it won’t search what I want.

SELECT 
    LEFT(datetime_view,10),
    count(type) 
        FROM reports 
            WHERE 
        type IN (1,2,5) 
            AND 
        datetime_view>='2012-10-28' 
            AND
        datetime_view<='2012-11-04' 
            group by LEFT(datetime_view,10);

You can see I must search from the future. Why??

It gives me an output from 28.10 to 3.11 ….

  • 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-13T17:10:33+00:00Added an answer on June 13, 2026 at 5:10 pm

    don’t use string operations on date/time values. MySQL has a huge set of functions for date/time manipulation. Try

    GROUP BY DATE(datetime_view)
    

    instead, which will extract only the date portion of the datetime field. Your string operation is not y10k compliant. Using the date() function is.

    As for your plus one day, consider how the comparisons are done: A plain date value, when used in date/time comparisons, has an implicit 00:00:00 time value attached to it, e.g. all dates have a time of “midnight”.

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

Sidebar

Related Questions

I have address data stored in an sql server 2000 database, and I need
I have a database with thousands of (latitude,longitude) points stored in it. Those points
Main problem: how do i group elements by their Date, only if continuous and
The main problem is square-space builds their forms with java-script (YUI). They have are
I have an application that currently stores timestamps in MySQL DATETIME and TIMESTAMP values.
I currently have a main stored procedure calling many stored procedures: Main --| --|
I have the following problem and I need to know if there´s a way
hello i have a problem that's maybe difficult to descripe, i have an application,
We have a relatively new database project that we have been writing views and
Here is the problem: I have one giant string of xml data stored in

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.