Skip to content
Advertisement

Tag: date

Convert date to ISO week date

How to convert dates to ISO week date in Impala SQL? For example 2019-12-30 in the ISO week date calendar would be written as 2020-W01-1 or 2020W011 ANSWER: Marked Gordon Linoff answer as correct, as it solves the essential part of the question, the deducing of the year part of ISO week date. For the week part of the ISO

Problems finding out Active users due to Hire/Resign Date

In my Employee table in SQL Server I have two datetime columns: HiringDate and ResignDate. I want to create a new column Status (Active, Inactive) in a view. If HiringDate is NULL or greater than today = Inactive If HiringDate is Active but ResignDate is earlier than today then Status also have to be Inactive. Do I have to make

Case when date = current_date then text

I have a table like this: But when I execute this query: I get this result: SQL Fiddle I would expect that in the rows where is_equal is true, the result should be TODAY. What am I doing wrong? Answer Nevermind, I solved it, but I don’t want to discard the question. The solution is to CAST(token_date as varchar) in

SQLite – TimeStamp to Date

I am trying to convert a timestamp to date in SQLite. But it give me always Null back, I try many solution I find out, but any solution works for me Here is my request : Thats my SQL script, if you want to try: Answer To expand on @forpas comment, SQLite does not have a TIMESTAMP data type, so

Oracle SQL closest date to given date

i have a table with a column for categories, date and price. Like this: So there are (almost) always two dates per group with two different prices. Now i need to write an SQL Statement to get the closest date per group to a given date(f.e. 05.05.2019). Group 1 has two dates an the SQL statement needs to Select one

Comparing two dates in Oracle after using TO_DATE function

I have the following Oracle Query that is converting todays date and the date field from the table into the same format. However, when trying to compare the two they aren’t coming up as equal. The cast is used on the field in my table, both these return. However, when adding the following where statement no rows are returned. I

Advertisement