Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 3rd, 2004, 08:38 PM
sundarr123123 sundarr123123 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 8 sundarr123123 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question query join

hi,
i have 2 select statements like

select bdm, status, sum(nbr), sum(annualprem)
from mgtrptdetails
where
processdate >='01-oct-2004' and
processdate <= '31-oct-2004' and
status='Submitted' and
trim(channel) = 'OFFICE BUS' and
((nvl(trim(bdm),'NA') = nvl(trim(bdm),'NA')))
group by bdm, status;


o/p
bdm status sum(nbr) sum(annualprem)
submitted 7 1800
mc submitted 1 11
mo submitted 1 45


2 select is :

select bdm, status, sum(nbr), sum(annualprem)
from mgtrptdetails
where
processdate >='01-oct-2004' and
processdate <= '31-oct-2004' and
status='Submitted' and
trim(channel) = 'OFFICE BUS' and
(ascii(bdm) = 32)
group by bdm, status;

o/p
bdm status sum(nbr) sum(annualprem)
submitted 7 1900


how can i join these 2 queries so as to get

o/p
bdm status sum(nbr) sum(annualprem)
submitted 14 3700
mc submitted 1 11
mo submitted 1 45

Reply With Quote
  #2  
Old November 4th, 2004, 02:08 AM
swampBoogie swampBoogie is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jan 2003
Location: Paris Uppland
Posts: 1,784 swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Weeks 4 Days 21 h 42 m 49 sec
Reputation Power: 37
Code:
select bdm, status, sum(nbr), sum(annualprem)
from mgtrptdetails
where
processdate >='01-oct-2004' and
processdate <= '31-oct-2004' and
status='Submitted' and
trim(channel) = 'OFFICE BUS' and
(nvl(trim(bdm),'NA') = 'NA' or ascii(bdm) = 32)
group by bdm, status;

Reply With Quote
  #3  
Old November 4th, 2004, 04:56 PM
sundarr123123 sundarr123123 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 8 sundarr123123 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question not fetching ....

its not combining the results .. its just taking either if its nvl r ascii(32)... moreover, i cannot group by bdm as it is a varchar field.

thanks

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > query join


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT