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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:04:34+00:00 2026-06-17T17:04:34+00:00

Im trying to execute the following SQL query and filter out the data based

  • 0

Im trying to execute the following SQL query and filter out the data based on the date.

I need to display a table which filters out the data such that, only those rows which are between the mentioned start_date and end_date

Here’s the query that I have been trying

SELECT DISTINCT T1.column1, T1.column2, T2.START_DATE, T2.END_DATE
FROM Table1 T1, Table2 T2
WHERE (T1.column1= T2.column2) AND
(T2.START_DATE >= '15/01/2013 10:58:58' AND 
   T2.END_DATE <= '18/01/2013 10:58:58') ORDER BY T2.START_DATE DESC

I get the result with values from 2012 as well. Please help me out

Thanks

  • 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-17T17:04:35+00:00Added an answer on June 17, 2026 at 5:04 pm

    Since you have not mentioned about any errors, if START_DATE and END_DATE are DATETIME data type, there is nothing wrong with your query. If you are not getting the correct records, Please check the data.

    However your date format may trouble you in a different server. There are some good practices you could adhere to avoid such issues.

    -Whenever date is used as a string, try to use it in ISO or ISO8601
    format (ie ‘yyyymmdd’ or ‘yyyy-mm-ddThh:mi:ss.mmm’)

    -Also avoid joining tables with WHERE Table1, Table2 which is old and
    obsolete. JOINs are much better performed, neat and tidy.

    You can change your query as follows;

    SELECT DISTINCT T1.column1, T1.column2, T2.START_DATE, T2.END_DATE
    FROM Table1 T1 JOIN Table2 T2 ON T1.column1 = T2.column2
    WHERE (T2.START_DATE >= '20130115 10:58:58' AND 
           T2.END_DATE <= '20130118 10:58:58') 
    ORDER BY T2.START_DATE DESC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to execute the following SQL query in SQL Server 2008 String query
I'm trying to figure out how to execute the following sql join statement in
I am trying to execute following query through PgAdmin utility. CREATE TABLE svcr.EventLogs (eventId
I'm trying to execute the following query through classic asp recordset - SQL =
I am trying to execute the following SQL query using MS SQL Server Management
I am trying to execute the following SQL query but it is not working:
I'm trying to execute the following SQL: SELECT * FROM Table2 INNER JOIN (SELECT
I'm trying to execute the following line: exit | sqlplus username/password@sid @test.sql Works great
I am trying to execute following query: Insert into pligg_links_temp select * from pligg_links
I am trying to execute the following query in oracle but not able to

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.