|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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; |
|
#3
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > query join |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|