Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Two queries optimize
- SELECT `type`, COUNT(`id`) AS 'type' FROM `items` WHERE `post` = `id` GROUP BY `type`;
- SELECT `type`, COUNT(`post`!=`id`) AS 'posts' FROM `items` GROUP BY `type`;
- SELECT `type`,
- COUNT(`post`=`id`),
- COUNT(`post`!=`id`) AS 'posts'
- FROM `items`
- GROUP BY `type`;
Add Comment
Please, Sign In to add comment