Trying to understand why my query is getting the error "Error running query: 000904 (42000): SQL compilation error: error line 16 at position 48 invalid identifier 'S1.V'".
Query:
with step1 as (
select
v:_id
from
PUBLIC.BUSINESSES
where
v:created::date between DATEADD(dd, 1, last_day(DATEADD(mm, -3, GETDATE()))) and getdate()
group by 1
),
step2 as (
select
distinct b.v:_id
from
step1 s1
inner join public.businesses b on b.v:_id = s1.v:_id
where
b.v:businessSetting = 'enabled'
)
select 'Businesses signedup' as step, count(*) as count from step1
union
select 'Enabled' as step, count(*) as count from step2
order by count desc
Is anyone able to help?
WITH step1 AS (is missing from the start of your SQL. - Jon Armstrongv:_idandv:created? - Gordon Linoffvper object - Maandeep