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: To get records without repeation of two fields.

Re: To get records without repeation of two fields.

From: rajXesh <rajXesh_at_hotmail.com>
Date: Fri, 31 Jan 2003 10:50:49 -0500
Message-ID: <2465174.1044028249@dbforums.com>

Originally posted by Anitha S
> Hi,
> Follow-up of my last query....
>
> I need to get values from a table where the two fields cannot have
> repeated values.Let the table be prod_master which has a primary key
> product_code.There are other two fields product_type and label_code.
> The requirement is that select query should fetch values which doesnt
> have product_type and label_code values repeating.
>
> example :
> i want to get those records which have values product_type and
> label_code (together)distinct or are unique value.
> if the table have values :
> product_type label_code
> 123 334
> 456 123
> 123 334
> 123 123
>
> I want to get the only the values :
> product_type label_code
> 123 334
> 456 123
> 123 123
>
> Hope this makes it more clear.
>
> Anitha Shenoy
>
>
>
> Anitha Shenoy.
>
> DA Morgan wrote in message news:news:...
> > Anitha S wrote:
> >
> > > Hi,
> > > I need to get values from a table where the two fields
> cannot have
> > > repeated values.
> > > Let the table be prod_master which has a primary key
> > > product_code.There are other two fields product_type and
> label_code.
> > > The requirement is that select query should fetch values which
> doesnt
> > > have product_type and label_code values repeating.
> > > so how would be the select query...?
> > > Pls help!
> > >
> > > Regards,
> > > Anitha Shenoy
> >
> > You need to clarify your request with a bit of sample data
> showing what
> > it looks like in the table and what you wish to retrieve.
> >
> > But taking a wild stab at your question ... I would say that you
> can not
> > do it except by means of GROUP BY or SELECT DISTINCT.
> >
> > Daniel Morgan

You have just answered your own question. Just as Dan Morgan said, you want to 'SELECT DISTINCT' columns from TABLE

--
All you need in this life is ignorance and confidence, and then success is sure. -- Mark Twain (1835 - 1910)


Posted via http://dbforums.com
Received on Fri Jan 31 2003 - 09:50:49 CST

Original text of this message

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