Advertisement
Guest User

Untitled

a guest
Feb 11th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.59 KB | None | 0 0
  1. SELECT DISTINCT
  2.             contenu.*,
  3.             users.pseudo AS author_name,
  4.             durees.libelle AS duree_name,
  5.             (SELECT SUM(vote) AS pts FROM contenu_votes WHERE contenu_id = contenu.id) AS votes
  6.       FROM contenu, tags, contenu_tags, users, durees
  7.       WHERE contenu.id = contenu_tags.contenu_id
  8.       AND tags.id = contenu_tags.tags_id
  9.       AND users.id = contenu.createur_id
  10.       AND durees.id = contenu.duree
  11.       AND tags.id in (SELECT * FROM (SELECT id FROM tags ORDER BY levenshtein_pct(search_key, '$key') desc limit 0,5) as t)
  12.       ORDER BY votes DESC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement