-ve value problem in sql query... [message #20001] |
Tue, 23 April 2002 10:13 |
smith
Messages: 7 Registered: April 2002
|
Junior Member |
|
|
Hi,
Here is my requirement.
Compare the result from both schemas. For example give me the difference only when two numbers are 5% different
Here are my schema's
SQL> select * from schema1.invoice;
NAME AMOUNT
--------------- ---------
sushi 100
Anuraag 100
Jayakumar 94
Jaya 95
SQL> select * from schema2.invoice;
NAME AMOUNT
--------------- ---------
sushi 85
Anuraag 95
jayakumar 100
Jaya 96
Here is the query i have written
select a.* from schema1.invoice a,schema2.invoice b
where (a.amount-b.amount)/100 >=0.05
and a.name=b.name;
NAME AMOUNT
--------------- ---------
Anuraag 100
sushi 100
The problem here is it's calculating the precentage
but it's not selecting the record where the name is "Jayakumar"
Because when it calculates the percentage becomes -ve value.
Could someone tell me how can i select that row also.
Thanks in advance,
Smith.
|
|
|
|