IF statement in ON clause Can you help correct the syntax for this code? 

INNER JOIN Users u 
ON case when c.sender = ? then c.reciever = u.id else c.sender = u.id 


How do I do I put a CASE statement in a JOIN clause?
You need to keep the comparison column outside of your CASE statement. 

INNER JOIN Users u 
ON u.id = CASE WHEN c.sender = ? then c.reciever else c.sender END