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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:34:47+00:00 2026-05-28T04:34:47+00:00

I have a table for matches. The table has a column named matchdate ,

  • 0

I have a table for matches. The table has a column named matchdate, which is a datetime field.

If I have 3 matches on 2011-12-01:

  • 2011-12-01 12:00:00
  • 2011-12-01 13:25:00
  • 2011-12-01 16:00:00

How do I query that? How do I query all matches on 1 single date?

I have looked at date_trunc(), to_char(), etc.
Isn’t there some "select * where datetime in date" function?

  • 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-28T04:34:48+00:00Added an answer on May 28, 2026 at 4:34 am

    Cast your timestamp value to date if you want simple syntax. Like this:

    SELECT *
    FROM   tbl
    WHERE  timestamp_col::date = '2011-12-01';  -- date literal
    

    However, with big tables this will be faster:

    SELECT *
    FROM   tbl
    WHERE  timestamp_col >= '2011-12-01 0:0'    -- timestamp literal
    AND    timestamp_col <  '2011-12-02 0:0';
    

    Reason: the second query does not have to transform every single value in the table and can utilize a simple index on the timestamp column. The expression is sargable.

    Note excluded the upper bound (< instead of <=) for a correct selection.
    You can make up for that by creating an index on an expression like this:

    CREATE INDEX tbl_ts_date_idx ON tbl (cast(timestamp_col AS date));
    

    Then the first version of the query will be as fast as it gets.

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

Sidebar

Related Questions

I have a table that has a column that contains links. Each cell in
I have a table that represents a series of matches between ids from another
I have a classified_id variable which matches one document in a MySql table. I
i have a notes column which contains text and has an id within the
Here's a SQL query that I slightly scrubbed (just the column/table/database names). I kept
I have a table that includes a column for the user to select from
I have a table and a query (within a PL/SQL packge) accessing that table.
I have a database table which contains an ID column and a Name column.
I have a table in a db that has a structure like this: Date
I have a table with string values that need to matched individually to a

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.