Hi all,

I could use a little guidance for solving a tricky (to me, a noob) SQL problem in Derby.

I have a table with columns like:

PrimaryKey, Enabled, OtherKey

The 'OtherKey' values are supposed to be unique, but because we have dirty data - they aren't.

I want to construct a query to list OtherKey values that appear more than once, and are enabled.

So for data like:

PrimaryKey,Enabled,OtherKey
pk01,T,okNotADupe0
pk02,T,okDupe
pk03,T,okDupe
pk04,F,okDupe
pk05,T,okNotADupe1

the query would return:

DupedOtherKey,PrimaryKeys
okDupe, "pk02|pk03"

The PrimaryKeys column is a list of strings, separated by '|'.

Is this easy to do in Derby?

Thanks in advance,
--Kent

Reply via email to