On Nov 21, 2011, at 21:11, David Johnston wrote:
> On Nov 21, 2011, at 17:23, jeffrey wrote:
>
>> 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 fol
On Nov 21, 2011, at 17:23, jeffrey wrote:
> 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
Another option is to perform a self-join on columns B, C, and D (filtering out
the 'same' record where a=a) instead of using the sub-select. This may yield
better performance depending on the size of the table. Also, I don't believe
the concatenation / sub-select will work if all of B, C, and
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
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