I want to sum journalamt but using the part field in the group by satement but it will only let me use the posting_code field
I know its probably simple but I don't write SQL
SELECT journal_number, Left(posting_code,2) as part, SUM(journal_amount) as journalamt
FROM [CS311].[scheme].[nltranm]
where (journal_number not like 'c3%' and journal_number not like 'cp%') and (journal_date = CAST(FLOOR(CAST(getdate()-1 AS FLOAT)) as DATETIME))
Group by journal_number,posting_code
order by journal_number,part
I know its probably simple but I don't write SQL
SELECT journal_number, Left(posting_code,2) as part, SUM(journal_amount) as journalamt
FROM [CS311].[scheme].[nltranm]
where (journal_number not like 'c3%' and journal_number not like 'cp%') and (journal_date = CAST(FLOOR(CAST(getdate()-1 AS FLOAT)) as DATETIME))
Group by journal_number,posting_code
order by journal_number,part