Question : results based on multiple rows in a join

Experts, consider the following tables:

TABLE A                                          
col1      col2      col3      col4      col5      col6            
1      2      A      2      5      10            
1      2      A      2      6      11            
1      2      B      3      4      12            
1      2      NULL      5      6      13            
1      2      C      3      4      14            
                                          
TABLE B                                          
col1      col2      col3      col4      col5                  
1      2      1      2      A                  
1      2      1      2      B                  
1      2      1      2      C                  
                                          
DESIRED RESULT:                                          
5      6      3      4      12                  
5      6      3      4      14                  
                                          
CONDITIONS:                                          
A.COL1=B.COL1 and A.COL2 and B.COL2                                          
WHEN A.COL3 = NULL, GET THAT ROW'S COL4 and COL5 as the first 2 columns in the output. This is condition #1                                          
There will be only one such NULL for (COL1+COL2) combination                                          
IF THERE IS A ONE TO ONE MATCH BETWEEN (A.COL1+A.COL2+A.COL3 = B.COL3+B.COL4+B.COL5)                                          
THEN GET  A.COL4+A.COL5+A.COL6 for the next 3 columns in the output for each such matching records. Then it is condition #2                                          
In the above example, A.COL1+A.COL2+A.COL3 of (1,2,A) disqualifies because it is 2 times in TableA and once in TableB(Not one to one)                                          
If both conditions match, then the output rows can be derived as shown above.            

How would you achieve this in pl-sql?

thanks                              

Answer : results based on multiple rows in a join

> I have renamed this file mod_menu_data.cfm

If you run the page mod_menu_data.cfm it errors because the cfquery uses a variable named #church_id#, but it's not defined. If that page requires 1 or more parameters, try passing them in the <link..> url:

    <script type="text/javascript" src="mod_menu_data.cfm?church_id=3"></script>

You might also want to set default values for all parameters, to avoid errors if they're not defined for some reason
Random Solutions  
 
programming4us programming4us