vendredi 31 juillet 2015

How to convert mysql query into postgresql

Hey I am trying to change the mysql query into postgresql . How can I convert this mysql query into postgresql . Here is the mysql query below .

SELECT u.id,c.m_id,u.name,u.email
 FROM messages c, users u
 WHERE (CASE 
 WHEN c.user_one = 1
 THEN c.user_two = u.id
 WHEN c.user_two = 1
 THEN c.user_one= u.id
 END )
 AND (
 c.user_one ='1'
 OR c.user_two ='1'
 )
 Order by c.m_id DESC Limit 20

Aucun commentaire:

Enregistrer un commentaire