Home » SQL & PL/SQL » SQL & PL/SQL » comparing two varchar2
comparing two varchar2 [message #727] Thu, 28 February 2002 08:19 Go to next message
Antoni
Messages: 8
Registered: February 2002
Junior Member
Hi,

I want to know how to compare part of the value of a column:

IE: I HAVE

Code_client Code_product Purchase
123 021130 45
123 021140 55
123 032110 34
123 032120 67

I want the sum of the purchasing of the code_products that have the first four position equal

output:
Code client Code_product Purchase
123 0211 100
123 0321 101

Thanks a lot
Re: comparing two varchar2 [message #730 is a reply to message #727] Thu, 28 February 2002 09:36 Go to previous message
monir
Messages: 22
Registered: February 2002
Junior Member
select t1.code_product from table_name t1,table_name t2
where substr(t1.code_product,1,4) = substr(t2.code_product,1,4)
Previous Topic: How to export the selected contents of a table
Next Topic: Re: whynot>rownum?
Goto Forum:
  


Current Time: Thu Mar 28 18:10:37 CDT 2024