All Forums Database
praveen_reddy 22 posts Joined 10/11
19 Apr 2014
Regarding date format

Hi all,
 
I created a table 

create table financial.test

 (empid integer not null, 

 ename char(30), 

hiredate DATE FORMAT 'ddmmyyyy' )

primary index (empid);

 

and inserted data into it and the data is as fallows

 

empid ename hiredate

1 101 abc 01-01-2000

2 109 f 11-04-2013

3 108 e 12-04-2013

4 107 d 13-04-2013

5 106 c 14-04-2013

6 105 f 15-04-2013

7 104 e 16-04-2013

8 103 d 17-04-2013

9 102 c 18-04-2013

10 101 b 19-04-2013

 

but when i am firing the below query its showing zero records

 

sel empid,ename, cast (hiredate as date format 'yyyymmdd')

 from financial.test 

 where hiredate >=current_date -7 ;

 

can any one help this the data should come after 12th hired employees..

 

Adeel Chaudhry 773 posts Joined 04/08
19 Apr 2014

Dear, your hiredate is of year 2013 and current_date would definitely be of year 2014.

-- If you are stuck at something .... consider it an opportunity to think anew.

You must sign in to leave a comment.