Tuesday, August 19, 2008

TO_DATE Function in SQL

How to find the names of employees who joined between 10th and 20th of August 2008.

SELECT empName FROM emp WHERE joining_date between to_date ('2008/08/10', 'yyyy/mm/dd')AND to_date ('2008/08/20', 'yyyy/mm/dd');

Link-1 and Link-2 helps us understand, to_date and to_char functions better.

ORDER BY TO_DATE(TO_CHAR(APPROVEDBYDATE,'MM/DD/YYYY'),'MM/DD/YYYY')

No comments: