I think you should not "add columns", but concatenate them.
Instead
select A from table_name where B+C+D in (select B+C+D from table_name
group by B+C+D having count(*)>1 )
use "B || '/' || C || '/' || D"
select A from table_name where B || '/' || C || '/' || D in (select B || '/' || C || '/' || D from table_name
group by 1 having count(*)>1 )
You may need to apply some conversion (cast) depending of data type and output format.
Regards,
Edson Carlos Ericksson Richter SimKorp Informática Ltda |
Fone: | (51) 3366-7964 |
Celular: | (51)9318-9766/(51) 8585-0796 |
 |
Em 21-11-2011 20:23, jeffrey escreveu:
Lets say that the primary key column is A. I am trying to select all
the rows with duplicated values in columns B, C, and D.
I am not too experienced in SQL syntax, and I've used the following:
select A from table_name where B+C+D in (select B+C+D from table_name
group by B+C+D having count(*)>1 )
I'm looking for a better way, since I am just adding the three columns
together right now.
Jeffrey