Skip to content
Advertisement

Tag: vertica

SQL function to generate new row per event?

I’ve looked for an answer here to no avail; wondering if this problem is best suited outside SQL environment but thought I’d see how it could be solved. I’m trying to look at web journeys and as a result need my data to be in the following format: At present the data is in the following format: I essentially want

Vertica: How to create a new column by subtracting two other columns?

I have a Vertica table named Start_End like: It has about 100,000 rows. How can I use months_between to subtract Started from Ended? The resulting table would look like: The following will add a blank column: How can I use months_between? Answer Check here: https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/SQLReferenceManual/Functions/Date-Time/MONTHS_BETWEEN.htm?zoom_highlight=MONTHS%20BETWEEN to find out if the behaviour of MONTHS_BETWEEN() (when to return INTEGER, when to return

Case statements around values in a list

I have a table that looks like below after performing certain joins: create table test(id varchar(10), sub varchar(20)); insert into test values(1,’a’) insert into test values(1,’b’) insert into …

Advertisement