|
-
March 24th, 2010, 07:19 AM
#4
Re: Oracle how to get this result?
 Originally Posted by cpu2007
Code:
SELECT d.dlrname,b.DLRCODE, b.bikepurchprice, b.bikesellprice
FROM rr_bike b,rr_dealer d
where d.dlrname=d.dlrname and b.dlrcode>0;
This query creates a cross product of the rr_bike records with a dlrcode > 0 and rr_dealer records with a non-null dlrname (d.dlrname is always equal to itself, except when it is null).
You have to change the WHERE clause to have a one-to-many relationship between the two tables and use grouping to calculate the totals you need.
As suggested by ideru, you may also have issues if different dealers can have the same name.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|