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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:28:39+00:00 2026-06-03T01:28:39+00:00

i have problem with my sql.The problem is a result data from the table

  • 0

i have problem with my sql.The problem is a result data from the table is not same like i put in parameter.
can you check what’s wrong with my code?.

This is my code:-

select distinct  convert(varchar(10),a.entered,103) as
daterange  from customer
where
((a.entered BETWEEN convert(varchar(10),&daterangefrom,103) AND convert(varchar(10),&daterangeto,103)) or (convert(varchar(10),&daterangefrom,103) =' ' AND convert(varchar(10),&daterangeto,103) =' '))
  • 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-03T01:28:41+00:00Added an answer on June 3, 2026 at 1:28 am

    You are comparing the dates as strings, but the dd/mm/yyyy format that you are using doesn’t work for such comparisons. For example, '2/4/1976' > '1/9/2012'.

    Compare the dates as dates:

    select distinct convert(varchar(10),a.entered,103) as daterange
    from customer
    where (
      (&daterangefrom = ' ' AND &daterangeto = ' ') or
      (a.entered BETWEEN &daterangefrom AND &daterangeto)
    )
    

    Alternatively, use the ISO 8601 based yyyy-mm-dd format, which does work as string comparisons:

    select distinct convert(varchar(10),a.entered,103) as daterange
    from customer
    where (
      (a.entered BETWEEN convert(varchar(10),&daterangefrom,120) AND convert(varchar(10),&daterangeto,120)) or
      (&daterangefrom =' ' AND &daterangeto =' ')
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello, I have the following sql table + data: CREATE TABLE IF NOT EXISTS
i have a problem in inserting some data into a table. I have done
I have a method that pulls down data from a SQL Server Compact db:
I have two processes that work with data in the same table. One process
We have manage to export data from our mysql table into a .txt file.
i have a problem with sql query. I need to get list of users.
I have a problem with the SQL statement detailed below. The query returns the
I have a problem with an SQL query. SELECT SUM(table_colum) AS value, SUM(value *
I have a problem with a sql-statement. My DB is MySQL 5.1. I have
I have problem with Oracle 9.2 and JMS. I created PL/SQL routine to send

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.