Guest User

Untitled

a guest
Jan 23rd, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. $baseString =
  2. "SELECT
  3. i.id,
  4. i.conceptId,
  5. i.date,
  6. SUM(case
  7. when v.type = 0 then -1
  8. when v.type = 1 then 1
  9. else 0 end) AS score,
  10. (SELECT COUNT(*) FROM appreciations WHERE iid=i.id) AS appreciations
  11. FROM ideas i
  12. LEFT JOIN votes v ON i.id=v.iid ";
Add Comment
Please, Sign In to add comment