Quote:
Originally Posted by krontrex
Code:
select COUNT(val) from my_table GROUP BY "val";
|
This statement does not make sense to me. What you would get is something like: 2,6,8
What do you do with that information?
Quote:
|
select ID, COUNT(val) from my_table GROUP BY "val";
|
What exactly do you want to count there?
How many distinct values val has for a certain ID?
You need to show us some sample data (ideally as INSERT INTO ...) and the desired output based on that sample data.
Although I do not really understand your question, the following
might(!) be what you are looking for:
Code:
SELECT id,
val
count(*) over (partition by val) as counter
FROM my_table