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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:57:56+00:00 2026-06-15T19:57:56+00:00

How can i select all fields in mysql starting with 2012-02? What i’ve tried:

  • 0

How can i select all fields in mysql starting with “2012-02”?

What i’ve tried:

mysql> SELECT title,id FROM dle_post WHERE approve='1' AND date = '2012-02-13 21:35:00';
+-------------------------------------------------+----+
| title                                           | id |
+-------------------------------------------------+----+
| test title                                      |  7 |
+-------------------------------------------------+----+


mysql> SELECT title,id FROM dle_post WHERE approve='1' AND date='2012-02%';
Empty set, 2 warnings (0.00 sec)

mysql> SHOW WARNINGS;
+---------+------+-----------------------------------------------------------------+
| Level   | Code | Message                                                         |
+---------+------+-----------------------------------------------------------------+
| Warning | 1292 | Incorrect datetime value: '2012-02%' for column 'date' at row 1 |
| Warning | 1292 | Incorrect datetime value: '2012-02%' for column 'date' at row 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-15T19:57:57+00:00Added an answer on June 15, 2026 at 7:57 pm

    Ideally, dates should be treated as dates, not as strings. This query should return all rows for February 2012 and it should outperform LIKE % queries:

    SELECT title, id
    FROM dle_post
    WHERE approve = 1 
    AND date >= '2012-02-01' 
    AND date <  '2012-02-01' + INTERVAL 1 MONTH
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can i select all rows where the month is 04 from 2010 where
SELECT name FROM sys.databases -- this can list all database name in the server
I have this code to select all the fields from the 'jobseeker' table and
For simplicity, assume all relevant fields are NOT NULL . You can do: SELECT
How can I select all id's for records in single cell? For example: --example
I am using the following Expression to select all hyperlinks //a[@href] How can I
I need to grant privileges to all users, I can do: GRANT select on
In Photoshop you can select Color (the second from the bottom) to set the
I'm trying to select all fields in two separate tables as long as they're
In MySQL, how can you select data where every row meets a certain condition?

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.