Java bro

Java tutorial

Sql queries

Get first date of last month in sql

In this article we wre going write a query to get first day of last month. See the below query.

Query:

SELECT TO_CHAR( TRUNC(ADD_MONTHS(SYSDATE, -1), ‘MM’),’MM-DD-YYYY’) AS FIRST_DATE FROM DUAL ;

Output :

FIRST_DATE
02-01-2016

Comments are Closed

Theme by Anders Norén