Incorrect syntax error and I can't tell why

I'm getting a syntax error on a column that I'm using to join two tables. It's a simple join and query and I can't see why it would be giving me that error.

select *
from dbo.APM_MASTER__CHECK cm
join dbo.APM_MASTER__DIST_PAYMENT dp
on cm.Vendor = dp.Vendor and cm.Payment_ID = dp.Payment_ID and cm.Check = dp.Check

Incorrect syntax near 'Check' and both the cm.Check and dp.Check are underlined in red. I do much more complicated joins all the time so there must be something about that word that is tripping me up. Can anyone help me please?

"Check" is a reserved word, so you have to put it in brackets:

select *
from dbo.APM_MASTER__CHECK cm
join dbo.APM_MASTER__DIST_PAYMENT dp
on cm.Vendor = dp.Vendor and cm.Payment_ID = dp.Payment_ID and cm.[Check] = dp.[Check]

1 Like

Thank you!!!