Guest User

Untitled

a guest
Jul 4th, 2012
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.55 KB | None | 0 0
  1. SELECT SUM(i.score * t.COUNT) AS score
  2. FROM            search_index i
  3. INNER JOIN      search_total t      ON i.word = t.word
  4. INNER JOIN      node n          ON n.nid = i.sid
  5. INNER JOIN      node_access na      ON na.nid = n.nid
  6. WHERE   n.STATUS = 1
  7.         AND (na.grant_view >= 1
  8.             AND ((na.gid = 0 AND na.realm = 'all')
  9.                 OR (na.gid = 1 AND na.realm = 'workflow_access')
  10.                 OR (na.gid = 0 AND na.realm = 'workflow_access_owner')))
  11.         AND (i.word = 'sghsfghnsf')
  12.         AND i.TYPE = 'node'
  13. GROUP BY i.TYPE, i.sid
  14. HAVING COUNT(*) >= 1
  15. ORDER BY score DESC LIMIT 0, 1
Advertisement
Add Comment
Please, Sign In to add comment