Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: To get records without repeation of two fields.
A more general question might be why would there be different type and label for the same product code? Wouldn't that be a little confusing when trying to describe any one product?
rs_arwar_at_hotmail.com (Rauf Sarwar) wrote:
>shenoyanitha_at_hotmail.com (Anitha S) wrote in message news:<7fcb5990.0301310607.2212b13d_at_posting.google.com>...
>> 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.
>>
>
>
>select distinct product_type, label_code
>from table_name;
>
>Regards
>/Rauf Sarwar
Received on Tue Feb 04 2003 - 13:13:51 CST