RockOrDead
RockOrDead

Reputation: 340

PostgreSQL RIGHT JOIN ERROR: syntax error at or near "RIGHT"

Please tell me what is wrong with that sql ?

SELECT users_map.user_id 
FROM users_map
WHERE users_map.service_id = 1
AND users_map.service_user_id = 0
RIGHT OUTER JOIN user_data
ON users_map.user_id = user_data.user_id

Upvotes: 0

Views: 1826

Answers (1)

Giorgos Betsos
Giorgos Betsos

Reputation: 72175

WHERE clause should be placed at the end of your query:

SELECT users_map.user_id 
FROM users_map
RIGHT OUTER JOIN user_data
  ON users_map.user_id = user_data.user_id
WHERE users_map.service_id = 1 AND 
      users_map.service_user_id = 0

Upvotes: 2

Related Questions