Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL-question (two fields in one)

Re: SQL-question (two fields in one)

From: TurkBear <jvgreco_at_primenet.com>
Date: 1997/06/12
Message-ID: <33a02d1a.69020875@news.primenet.com>#1/1

Try this :

'create table test_dups as select field1||field2 combofield from orig_table'

The concatenation needs to have a column name alias ( combofield)...then you can try to create a unique index on the combofield in the test_dups table - this will fail if there are indeed dups...

Try it and let me know.
John.Greco_at_dot.state.mn.us

p.s. you might need to use 'select TrimRight(field1) || TrimLeft(field2' to deal with blanks in the fields ...

roar_at_link.no (Roar Pettersen) wrote:

>I have a problem where I need to check if I have duplicates of
>my data. The data is stored in a table, where the combination of
>two fields together make the rows unique. This makes checking
>for duplicates difficult, (or at least I have not found a solution).
>What I need to do (I think) is some way to select the two important
>fields "together" into one field in a temporary table, so that
>they make out one unique string. Does anybody know how to do
>this in sqlplus, or do I need more sophisticated tools to do
>it? (for the moment, sqlplus is all I have) And last but not
>least; HOW do I do it?
>
>(I was thinking of unloading the data to a text-file, and
>using the unix-command "sed" to paste the two fields together,
>but this seems like a problem "somebody must have had before",
>so I hope you guys can give me a better suggestion...)
>--
>Roar Pettersen
>roar_at_link.no
>http://www.link.no/roar/
Received on Thu Jun 12 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US