Re: [GENERAL] Select duplicated values

2011-11-21 Thread David Johnston
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

Re: [GENERAL] Select duplicated values

2011-11-21 Thread David Johnston
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

Re: [GENERAL] Select duplicated values

2011-11-21 Thread Pete Yunker
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

Re: [GENERAL] Select duplicated values

2011-11-21 Thread Edson Richter
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

[GENERAL] Select duplicated values

2011-11-21 Thread jeffrey
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