Skip to content

Instantly share code, notes, and snippets.

@libitte
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save libitte/9090829 to your computer and use it in GitHub Desktop.

Select an option

Save libitte/9090829 to your computer and use it in GitHub Desktop.

user ごとの 件数のうち最大件数をしらべる

SELECT MAX(counted) FROM
(
SELECT COUNT(*) AS counted
FROM table_actions
WHERE status = "good"
GROUP BY user
) as counts;
@libitte
Copy link
Copy Markdown
Author

libitte commented Sep 27, 2014

select max(counted) from (select count(*) as counted from user_goods group by user_id) as counts;
+--------------+
| max(counted) |
+--------------+
|           63 |
+--------------+
1 row in set (0.00 sec)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment