When I execute
select *, count(*) c
FROM mytable
GROUP BY col3, col4
HAVING c > 1
order by col4, col3;
I was expecting to get rows where for ANY value, among selection, there are at least two equivalent (col3, col4). However I get the results where only one row occurs with some col3 values. Could anybody please explain why?
With another words, I'm trying to build the query that gets all rows for wichch the pair (col3, col4) occurs more than once.
The example of the unexpected result is this:
id - col1 - col2 - col3 - col4 - c
123- val1 val123 43 val444 2
456- val14 val52 45 val444 2
43 from column col3 never occurs in the result, but I would expect. Otherwise this row should not be in the result.
Correct,
select * from ukberu1m where col3=43 and col4=val444;
gives two results in the original table, but in the result table only one row is displayed by the wishful criteria, not two by some reason.