I am attempting to create a new table from the results a query. I've attempted select into, also have attempted create table.
I've attempted select into, also have attempted create table.
This is my original code, I am attempting to create a new table from the output of this code called 'InitialJoinwithCPCL'
select *
from [dbo].[Combined] as a
left join [dbo].[CPCL] as b
on a.[StateAbbr] = b.[ST] and a.[CropName] = b.[CROPNAME]
where cropyear <> 2019 and (policynumber is not null)
and (PolicyAcres <> 0) and (Policyliability <> 0 or PolicyAcres <= 0) and (Endorsement is null)
I have attempted this but get this error, 'Incorrect syntax near '('.'
create table InitialJoinwithCPCL
as (select *
from [dbo].[Combined] as a
left join [dbo].[CPCL] as b
on a.[StateAbbr] = b.[ST] and a.[CropName] = b.[CROPNAME]
where cropyear <> 2019 and (policynumber is not null)
and (PolicyAcres <> 0) and (Policyliability <> 0 or PolicyAcres <= 0) and (Endorsement is null));