A Database Error Occurred

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and referred_transaction.to_user_id = user.id and referred_tra' at line 8

select user.username as username, user.id as id, referred_transaction_description.description as description, referred_transaction.amount as amount, referred_transaction.status as status, referred_transaction.post_date as post_date from referred_transaction,referred_transaction_description,user where referred_transaction.to_user_id = and referred_transaction.to_user_id = user.id and referred_transaction.id = referred_transaction_description.referred_transaction_id and referred_transaction.post_date like '2017-05%'