I have a query that is using Table1
and Table2
with left outer join on 'usage'
. Now i have to join that query with the Table3
with (I guess recursive sql) to generate the 'Resulting table'
.
I saw lot of examples on recursive sql, but didnt find any thing that is using left outer join. Now my existing query is like this
select PIN, startDt, StartTm, usage, Min
from Table1 t1 left Outer join Table2 t2 on t1.usage= t2.usage;
How can i do the Table3
with this query, so that ratGrp will be in comma separated way? Please help!!
Table1
PIN startDt StartTm usage Min
-----------------------------------------
123 08/03/2014 12:12:00 500 4567
234 08/04/2014 12:12:00 200 4568
.....
Table2
1stCol 2ndCol usage
------------------------
abc 234 500
Table3
PIN ratGrp
-----------------
123 3300
123 100
123 103
234 3300
234 550
Resulting table
PIN startDt StartTm usage Min ratGrp
-----------------------------------------------
123 08/03/2014 12:12:00 500 4567 3300,100,103
234 08/04/2014 12:12:00 200 4568 3300,550