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

  • Home
  • SEARCH
  • 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 8956091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:42:36+00:00 2026-06-15T14:42:36+00:00

Possible Duplicate: Mysql query: retrieve current date query I need a MySQL query that

  • 0

Possible Duplicate:
Mysql query: retrieve current date query

I need a MySQL query that will select some data that contains todays date. I have built the following query:

SELECT CRM_TRATATIVAS.ID_Vendedor, CRM_TRATATIVAS.Fecha
FROM CRM_TRATATIVAS
GROUP BY CRM_TRATATIVAS.ID_Vendedor, CRM_TRATATIVAS.Fecha, CRM_TRATATIVAS.ID_Categoria
HAVING (((CRM_TRATATIVAS.ID_Vendedor)=10 Or (CRM_TRATATIVAS.ID_Vendedor)=29 Or (CRM_TRATATIVAS.ID_Vendedor)=32) AND ((CRM_TRATATIVAS.Fecha)=Date()) AND ((CRM_TRATATIVAS.ID_Categoria)=14));

If I take the =Date() away, it works. Any ideas what the problem could be?

The final data show be something like this without the brackets and dots (I couldn’t find how to make a table!

 Fecha                      Vendedor
 2012-12-03 10:12:13        (10)
 2012-12-03 12:14:16        (10)
 2012-12-03 09:15:46        (29)
 2012-12-03 13:35:56        (32)

Fixed!

I fixed by using this query.

SELECT CRM_TRATATIVAS.ID_Vendedor, CRM_TRATATIVAS.Fecha
FROM CRM_TRATATIVASGROUP BY CRM_TRATATIVAS.ID_Vendedor, CRM_TRATATIVAS.Fecha, CRM_TRATATIVAS.ID_Categoria
HAVING (((CRM_TRATATIVAS.ID_Vendedor)=10 Or (CRM_TRATATIVAS.ID_Vendedor)=29 Or (CRM_TRATATIVAS.ID_Vendedor)=32) AND ((DATE(CRM_TRATATIVAS.Fecha)) = CURDATE()) AND ((CRM_TRATATIVAS.ID_Categoria)=14));

As Fecha was a DATETIME column, I added Date just before the reference to convert it into a date.

  • 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-15T14:42:38+00:00Added an answer on June 15, 2026 at 2:42 pm

    Try to change:

    CRM_TRATATIVAS.Fecha=Date()
    

    with this:

    DATE(CRM_TRATATIVAS.Fecha)=CURDATE()
    

    CURDATE() returns the current date, and DATE(Fecha) returns just the date part of Fecha (without hours, minutes and seconds). I also suggest you to write the query this way, that looks cleaner:

    SELECT Distinct
      CRM_TRATATIVAS.ID_Categoria,
      CRM_TRATATIVAS.ID_Vendedor,
      CRM_TRATATIVAS.Fecha
    FROM
      CRM_TRATATIVAS
    WHERE
      CRM_TRATATIVAS.ID_Vendedor in (10, 29, 32)
      AND DATE(CRM_TRATATIVAS.Fecha) = CURDATE()
      AND CRM_TRATATIVAS.ID_Categoria=14
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: MySQL #1054 unknown column I need a query that will pull only
Possible Duplicate: MySQL retrieve latest record for Group I have a query that groups
Possible Duplicate: php/Mysql query with inserting date fails I have a datepicker code below:
Possible Duplicate: MySQL query that computes partial sums ok, the question is not clear
Possible Duplicate: mysql case sensitive query 'm working on an PHP script that checks
Possible Duplicate: mysql count into PHP variable I have the following query that returns
Possible Duplicate: MYSQL COUNT GROUP BY question $query = SELECT * FROM product_id_1; $result
Possible Duplicate: MySql select format, round column When i make a SQL query using
Possible Duplicate: MySQL LIKE vs LOCATE I need to write a Mysql query which
Possible Duplicate: PHP MySQL multiple search query using option / select HTML form 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.