I have a query something like this,
SELECT SOME_ID, COUNT(ANOTHER_ID) AS WITHOUT_FILTER
from SOME_TABLE GROUP BY SOME_ID
this returns me
+------------+------------------+
| SOME_ID | WITHOUT_FILTER |
+------------+------------------+
| 1 | 40 |
| 2 | 30 |
+------------+------------------+
I have the same query with a condition which gives me filtered values.
SELECT SOME_ID, COUNT(ANOTHER_ID) AS WITH_FILTER
from SOME_TABLE WHERE SOME_COL > 10 GROUP BY SOME_ID
which returns obviously lesser values in the grouped_by section
+------------+----------------+
| SOME_ID | WITH_FILTER |
+------------+----------------+
| 1 | 20 |
| 2 | 15 |
+------------+----------------+
Now, I need a query to give me both the count values ie with condition and without condition in one single query. The result should be like this
+----------+----------------+---------------+
| SOME_ID | WITHOUT_FILTER | WITH_FILTER |
+----------+----------------+---------------+
| 1 | 40 | 20 |
| 2 | 30 | 15 |
+------------+--------------+---------------+
Please help me.
You can do this: