diff bw data of d same column

Go down

diff bw data of d same column

Post by hansi on Mon Mar 22, 2010 5:07 pm

que,,, For each employee, calculate the number of months between today and the date the employee was hired

hansi

Posts : 6
Points : 8
Join date : 2010-03-03
Age : 31
Location : u.p.

View user profile

Back to top Go down

Re: diff bw data of d same column

Post by Vineet_More on Mon Mar 22, 2010 5:33 pm

You can use months_between () function to calculate the number of months..
say for example
MONTHS_BETWEEN('01-SEP-95' '11-JAN-94') WILL GIVE YOU THE REQ RESULT

Vineet_More

Posts : 27
Points : 31
Join date : 2010-02-26

View user profile

Back to top Go down

Re: diff bw data of d same column

Post by hansi on Tue Mar 23, 2010 12:42 pm

Vineet_More wrote:You can use months_between () function to calculate the number of months..
say for example
MONTHS_BETWEEN('01-SEP-95' '11-JAN-94') WILL GIVE YOU THE REQ RESULT




oh yeah thnx,,,,,,

hansi

Posts : 6
Points : 8
Join date : 2010-03-03
Age : 31
Location : u.p.

View user profile

Back to top Go down

Re: diff bw data of d same column

Post by jeeva on Tue Mar 23, 2010 1:31 pm

can someone tel me how to use the above command!!!

SQL> select months_between('01-SEP-95' '11-JAN-94');

ERROR at line 1:
ORA-00909: invalid number of arguments

jeeva

Posts : 50
Points : 93
Join date : 2010-03-04

View user profile

Back to top Go down

Re: diff bw data of d same column

Post by hansi on Tue Mar 23, 2010 1:39 pm

u frgt 2 use comma and specify table name,,,,

select months_between('01-SEP-95','11-JAN-94')
from tablename;

hansi

Posts : 6
Points : 8
Join date : 2010-03-03
Age : 31
Location : u.p.

View user profile

Back to top Go down

Re: diff bw data of d same column

Post by jeeva on Tue Mar 23, 2010 1:55 pm

@hansi

can you post your table and the output for the above!!!

jeeva

Posts : 50
Points : 93
Join date : 2010-03-04

View user profile

Back to top Go down

Re: diff bw data of d same column

Post by hansi on Tue Mar 23, 2010 2:09 pm

ya sure

select months_between('01-SEP-95','11-JAN-94')
from emp_338049;

MONTHS_BETWEEN('01-SEP-95','11-JAN-94')
---------------------------------------
19.6774194
19.6774194
19.6774194
19.6774194
19.6774194
19.6774194


see u hav nthng 2 do wid tablename just specify it,,,,,,,,,

hansi

Posts : 6
Points : 8
Join date : 2010-03-03
Age : 31
Location : u.p.

View user profile

Back to top Go down

Re: diff bw data of d same column

Post by urvershi on Tue Mar 23, 2010 7:21 pm

hansi wrote:u frgt 2 use comma and specify table name,,,,

select months_between('01-SEP-95','11-JAN-94')
from tablename;



u can use "dual" table in place of table name

urvershi

Posts : 21
Points : 70
Join date : 2010-02-26

View user profile

Back to top Go down

Re: diff bw data of d same column

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum