I am trying to pull dates from a table where the Date IS NOT the first of the month. I tried the following and none worked:
Query #1
SELECT *
FROM analytics.main.main__flows
CONVERT(DATETIME,Floor(CONVERT(Float,created_timestamp))) NOT LIKE '%-01%',
Query #2:
SELECT *
FROM analytics.main.main__flows
WHERE ENTRY_NAME = 'Interest Paid'
AND CREATED_TIMESTAMP <> '%-01'
Query #3
SELECT created_timestamp
FROM analytics.main.main__flows
WHERE DATEPART(day, CREATED_TIMESTAMP) <> 1
AND DATEPART(day, created_timestamp) <> DATEPART(day, DATEADD(second,-1,DATEADD(month, DATEDIFF(month,0,effective_date)+1,0)))
Any suggestions would be appreciated
Which database platform are you on?
For SQL Server I'd use:
DAY(yourdate) != 1
For Oracle I'd use:
to_char(yourdate, 'DD') != '01'