Skip to main content

equivalent of Cross Apply with function in vertica

  • November 22, 2016
  • 0 replies
  • 9 views

vric

I have a select statement like



SELECT
sub.ts AS FULL_DT,
EXTRACT(DOW FROM DATE sub.ts)+1 DAY_IN_WEEK,
EXTRACT (DAY FROM DATE sub.ts) AS DAY_IN_MONTH,
EXTRACT (DOY FROM DATE sub.ts) AS DAY_IN_YEAR

 

I have to perform above select to the dates which are present in another table in vertica

I mean in the above query sub.ts would get replaced by col1 from table1.

table1 has data like

col1

'2016-01-01'

'2016-01-02'

'2016-01-03'

'2016-01-04'

 

For all these 4 row the above select should get executed..This can be achieved using CROSS APPLY and creating function which has the above select statement in SQL.

 

But please let me know how can we achieve same in VERTICA?