+ 1

SQL query

Select sum(overtime_hour) From table_name Where date>=(first day of the month) How to get first day of the month?

16th Jun 2018, 7:26 PM
Moosa Alnaabi
Moosa Alnaabi - avatar
3 ответов
+ 7
Why can't you just write the specific date you need? where date >= '01-06-2018'
16th Jun 2018, 8:24 PM
Ava 🐈
Ava 🐈 - avatar
+ 5
There is no universal solution to define the first day of the month with SQL dynamically. It’s depends on the database management system. MS SQL Server or Oracle or MySQL has own function to get date or parts of the date, but no function exist for this task. you have to write a function or procedere to get the value of the first date of the month dynamically.
17th Jun 2018, 11:12 AM
asa22