Skip to content
Advertisement

Tag: datetime

Adding hours to dates in Presto

In a Presto db table, I have two string fields, a date of the form, ‘2022-01-01’, and an hour of the form, 22, for 22:00. I’m trying to combine these two elements into a proper timestamp, with date, hours, minutes, seconds. How can I accomplish this? What I’ve tried so far However, I get the error that ‘hour’ is not

extract year_month from a date column along with other columns in a sql table

I have a sql table with multiple fields including (but not limited to the following): member_id, visit_date (in datetime format eg: 2016-01-01), visit_yr_qtr (as string, eg: 2016_Q1), purchase_item (ID number), and item_price (in US dollars). I would like to extract these fields, but also include year_month (2016- January or 2016-01)as a new field in the output. This is what I

Timeserial not recognized built in function in MS SQL

I am trying to implement an SQL query that gets records between today’s fixed timing 18:00 and yesterday’s fixed timing 18:00 based on a Date time column that I have in my table. I tried this query But, it’s throwing an error Timeserial is not a recognized built-in function name. Any ideas please? Answer It would be best to use

Search by best values for every minute

The problem I’m having is that I have a table of data that has a new row added every second (imagine the structure {id, timestamp(datetime), value}). I would like to do a single query for MSSQL to go through the table and output only the number of objects that have the top 2 values asc for each minute ( also

Advertisement