Advertisement
Guest User

Untitled

a guest
May 5th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT *,
  2.     (name IN ('František', 'Áron', 'Kopecký')) AS nameFound,
  3.     (surname IN ('František', 'Áron', 'Kopecký')) AS surnameFound
  4. FROM people
  5. ORDER BY (nameFound = 1 AND surnameFound = 1) DESC, surnameFound DESC
  6. GROUP BY id
  7. HAVING nameFound = 1 OR surnameFound = 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement