I am trying to run this query in SSMS the problem is i get returned the columns creation_date, transaction_type and RecordType which is fine, but as I run in my select query count(column_1) i get the following error
Column 'table_1.CREATION_DATE' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
DECLARE @creation_date date
, @transaction_type varchar
, @record_type int
, @column_1 varchar
select count(column_1) AS Volume
,JudgmentMonth=RIGHT(REPLACE(CONVERT(VARCHAR(7), creation_date, 103), '/', ''), 7)
,transaction_type,
REPLACE(record_type, 3, 2) as RecordType
from table_1
where transaction_type = 'PG'
and column_1 = 'CCJ'
Any Ideas on what i'm doing wrong, I am new to sql server and trying to convert this oracle query?
Many Thanks