473,385 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Why the query returns results having hire_date greater than given date?

itiger
12
Expand|Select|Wrap|Line Numbers
  1. SELECT last_name, TO_CHAR(hire_date, 'DD-Mon-yyyy')
  2. from employees
  3. WHERE TO_DATE(hire_date, 'DD-Mon-YYYY') < '01-Jan-1990';
  4.  
  5.  
  6. Output:
  7.  
  8. LAST_NAME       TO_CHAR(HIRE_DATE,'DD-MON-YYYY')
  9. -------------------------------------------------- 
  10. King            17-Jun-1987 
  11. Kochhar         21-Sep-1989 
  12. De Haan         13-Jan-1993 
  13. Hunold          03-Jan-1990 
  14. Ernst           21-May-1991 
  15. Austin          25-Jun-1997 
  16.  
Why the query returns rows of those employees having hire_date greater (after) '01-Jan-1990'.
Jan 19 '11 #1
1 2850
amitpatel66
2,367 Expert 2GB
Try this:

Expand|Select|Wrap|Line Numbers
  1. SELECT last_name, TO_CHAR(hire_date, 'DD-Mon-yyyy') 
  2. from employees 
  3. WHERE TO_DATE(hire_date, 'DD-Mon-YYYY') < 
  4. TO_DATE('01-Jan-1990','DD-Mon-RRRR');
  5. /
  6.  
Jan 19 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: | last post by:
I use MySQL from my php page and from phpMyAdmin. In Windows Server, following query works fine. In Linux Server instead it returns error. The SQL Query is: SELECT DISTINCT a.id, a.container,...
3
by: jeremy | last post by:
Hello. I have an asp.net application that resides on a non-DC / BDC Sharepoint Server (although it is logged into the domain). The application will perform lookups based on the current user...
2
by: Mattyboy | last post by:
Guys I have built a database with saved queries that runs fine in Access but when I call it from the web using ASP, an exception occurs. I have tried multiple ways of testing the databases with...
6
by: Liz Malcolm | last post by:
Hello and Thanks in advance for any help. I am using Access 2000. I have a data entry form that opens a main form (using the On Click event of the combo box ) with tab controls and 1 subform on...
2
by: Eckhart | last post by:
Dear All, Plz help me in optimising the following query, Reduce repeatable reads from the table via select ,ythe table sare not having referntial integrity constarints ,relations CREATE proc...
2
by: Cindy | last post by:
I have an Access 2003 database with a query that works fine on my PC but does not work on another PC. My PC has older versions of Access installed as well as 2003 - the other PC only has Access...
2
by: kshirsagar007 | last post by:
friends, I would like to optimize the following query....as its taking 2 minutes to get the records. select a.CODE "Code", ud.Name "Name", a.SchemeId "SchemeID" from (MASTER sh,...
5
by: Nates | last post by:
If i use the following in the query editor it returns rows from my database, however when i run the very same query in VBA the recordset recordcount returns -1 every time: sql = "SELECT uniqueid,...
1
by: rajeev14th | last post by:
How can i modify the following query in DB2 (CAST(SUBS_REFILL_COUPONNO_CHANNELID AS INTEGER) (FORMAT '9(16)') (CHAR(16)) ) where SUBS_REFILL_COUPONNO_CHANNELID is the column name of my table...
4
by: Tinus | last post by:
Hi This query works in mysql SELECT id FROM FILE WHERE created = ( SELECT max( created ) FROM FILE ) But not in php
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.