I am using SQL Server 2014 and I have the following T-SQL query which retrieves the dates of the first day of each month (based on my filters) from a Date Dimension Table: SELECT * FROM ( SELECT …
Tag: date
How to pull week ending dates and end of month when end of month is mid week
I’m unsure how to proceed with this or what to search for but here goes my attempt at explaining what I’m trying to do! There may be multiple ways to figure this out as well. I am working on a …
Postgres convert date time difference into HH:MM:SS
Ex: Diff is 0 years 0 months 5 days 20 hours 6 minutes 30 seconds. I want to convert this into HH:MM:SS format : 120:06:30. Answer tl;dr java.time Doing it on the Java side is simple with a column of a data type akin to the SQL-standard TIMESTAMP WITH TIME ZONE and driver compliant with JDBC 4.2 or later (for
MONTHNAME in Portuguese MYSQL
I´ve got a huge query (In a PHP file) that gives me a monthname from some dates: Is there a way to insert my language inline with MONTHANAME? Something like: I don´t want to write case for eveymonth to transform ‘Dec’ to ‘Dez’ and so on, this will take too long. Answer Unfortunately in MySQL this cannot be done dynamically
SQL Order by 2 conditions
Let’s say that I have a database, that looks like that: price date hour 12.00 2018-12-11 5 13.00 2018-12-04 2 14.00 2018-12-06 1 15.00 2018-12-11 1 16.00 2018-…
Send mail every N days in SQL
I need to send a warning mail 14 days before certificates valid_to date ends and also send email every 3 days from delay_days. Table Certificates consists of: ID(int) | cert_valid_to(date) | …
How to find previous date in HIVE
I want to find previous date in Hive. For example : I have Date as 20180821 (yyyyMMdd) format, I want to find previous date of this in Hive. I tried date_sub() function, seems it works only with yyyy-MM-dd format. How to solve my issue. Please help Answer In addition to already provided solution with unix_timestamp conversion, please consider also this.
Select data from date range between two dates and times
I have pretty much the exact same question as logged here Select data from date range between two dates But when I used the solution given it does not work for me. Only difference is that my table has date and time in the one column. So I want to be able to return all values that fall within the
How to convert a date format YYYY-MM-DD into integer YYYYMMDD in Presto/Hive?
How to CONVERT a date in format YYYY-MM-DD into integer YYYYMMDD in Presto/Hive? I am trying to convert the below list into YYYYMMDD integers WITH all_dates as (SELECT CAST(date_column AS …
SQL Month YTD and prior YTD data
I am trying to write a query to return Month-To-Date data for the Current Year, and also the Previous Year. Meaning I need data from 2017-07-01 to 2017-07-26 and also 2016-07-01 to 2016-07-26. However, my query currently returns data from 2017-07-01 to 2017-07-26 (correctly) but also returns data from 2016-07-01 to 2016-07-31 (incorrectly). How can I have the data for