Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $baseString =
- "SELECT
- i.id,
- i.conceptId,
- i.date,
- SUM(case
- when v.type = 0 then -1
- when v.type = 1 then 1
- else 0 end) AS score,
- (SELECT COUNT(*) FROM appreciations WHERE iid=i.id) AS appreciations
- FROM ideas i
- LEFT JOIN votes v ON i.id=v.iid ";
Add Comment
Please, Sign In to add comment