I'm trying to build a Segment Count history table. There's three columns in this table. I want to insert 5 rows daily. The code below worked (minus createdate
). I needed to add CreateDate
so as not to violate the primary key. After making CreateDate
a primary key i ran into the error:
Errors: Old style JOIN (ANSI JOINs) syntax is not allowed."
I think this can work with a tweak to my code - I just don't know what.
Columns
Segment Name (key)
Segment Count
Create Date (key - default getdate())
Code
select
'Appointed Advisors' as [Segment Name]
, (select count(*) from [Advisors - Appointed] ) as [Segment Count]
, getdate() as [CreateDate]
union
select
'Appointed Advisors - Engaged 30 days' as [Segment Name]
, (select count(*) from [Advisors - Engaged 30 days] ) as [Segment Count]
, getdate() as [CreateDate]
union
select
'Appointed Advisors - Engaged 60 Days' as [Segment Name]
, (select count(*) from [Advisors - Engaged 60 Days] ) as [Segment Count]
, getdate() as [CreateDate]
union
select
'Appointed Advisors - Unengaged 60 days' as [Segment Name],
, (select count(*) from [Advisors - Unengaged 60 days] ) as [Segment Count]
, getdate() as [CreateDate]
union
select
'Appointed Advisors - Producers' as [Segment Name]
, (select count(*) from [Advisors - Producers] ) as [Segment Count]
, getdate() as [CreateDate]