Skip to content
Advertisement

Get List of Last 15 Days Date in SQL

Could SQL get list of date of last 15 days date in a single query?

We can get today date with

select current_date()

We also can get last 15 days date with

select date_add(current_date(), -15)

But how to show the list of last 15 days date? For example the output is

Advertisement

Answer

In Hive or Spark-SQL:

Result:

See also this answer.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement