Get started Bring yourself up to speed with our introductory content.

Locating the first day of the month in SQL

Here you'll find a simple way to locate the first day of the month in SQL

I needed to select records for this month so far from the database, which required getting the first day of the...

current month. After a while, I worked out the following code. To get the prior 12 months, add "- 12 months" after the "+ 1 day" part. select * from file where indate >= date(curdate() - day(curdate()) days + 1 day)


The Best Web Links: tips, tutorials and more.

Visit the ITKnowledge Exchange and get answers to your developing questions fast.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.

This was last published in April 2005

Dig Deeper on iSeries SQL commands and statements

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.