oncik oncik - 1 month ago 7
SQL Question

Count how many month had passed

It goes like

SELECT fname, date_emped
FROM table_1


Then it gave me the table

fname | date_emped
------------------
John | 03-JAN-07
Smith | 02-JAN-08


I wanted to count how many months they had employed or worked here up until today.

Answer

I am not champ in orcale but this might do

	SELECT fname, date_emped, MONTHS_BETWEEN 
   (SYSDATE,
    date_emped) "Months"
FROM   table_1