0
votes

I'm looking to compare data in my Vertica connection for two different months in two different years.

October 2021 vs. April 2022

This data exists in the SAME database (call it BaseA).

I'm looking to pull ALL rows from BaseA for those specific months so i can compare the two months to one another easily.

I know I can pull them separately but really want to see them one over the other to compare performance metrics simply (row vs. row).

The closest I've come is the below:

select * from BaseA
where _id=12345 and
month(month) IN ('04','10')

However, this DOES NOT do the following:

  • return only 4/22 & 10/21 (m/y)
  • return data consolidated (grouped) by month (so multiple lines occur per month)

Can anyone assist with the additives to this query mentioned above? Can't share data sample as its company data.

1

1 Answers

0
votes

To get data for the two months try something like this:

select * from BaseA
where _id=12345 and
(
  (month(month) = '04' and year(month) = '2022')
  OR
  (month(month) = '10' and year(month) = '2021')
)

I have no idea what you mean by "return data consolidated (grouped) by month (so multiple lines occur per month)". Can you provide dummy data that illustrates the data that you have and the result that you want to achieve?