I am trying to get a resulting column of the initial month an ID was created where multiple table JOINs are needed in MySQL Workbench.
SET @in_month = '0';
SELECT
ca.id
FROM capital.user ca
JOIN
capital.user_account cd on ca.id = cd.user_id
JOIN
capital.transaction ct on cd.user_id = ct.user_account_id
JOIN
capital.transaction_event ce on ct.id = ce.auth_entry_id
@in_month = month(ce.created) WHERE ce.message = 'Approved'
Group by id;
I get Syntax error: '@in_month' (at text suffix) is not valid input at this position on line 17, any ideas of what I might be doing wrong? I don't have a lot of experience with SQL