[Solved] Oracle: Multiple joins with group by [closed]


SELECT * FROM A;

 A_ID A_NAME     A_ADDRESS
---------- ---------- ----------
     1 RAM        MO
     2 SITA       MI
     3 JANAKI     IL


SELECT * FROM B;

 A_ID B_NAME  
---------- ----------
     1 PAUL
     1 KAPIL
     2 DAVE

SELECT * FROM C;

B_NAME     C_TITLE
---------- ----------
KAPIL      HONDA
KAPIL      MAZDA
KAPIL      ODYSSY
DAVE       BENZE
DAVE       LIMOUSINE

SELECT a.A_ID, a.A_Name, a.A_Address, b.B_Name, Count(C_Title)
FROM A a 
INNER JOIN B b ON(a.A_ID = b.A_ID)
INNER JOIN C c ON(b.B_Name=c.B_Name)
GROUP BY a.A_ID, a.A_Name, a.A_Address, b.B_Name;



A_ID A_NAME     A_ADDRESS  B_NAME     COUNT(C_TITLE)
---------- ---------- ---------- ---------- --------------
     2 SITA       MI         DAVE                    2
     1 RAM        MO         KAPIL                   3

Here, I consider that B_Name in table C have reputation values(as it is a foreign key) and the A_ID in A, B_Name in B are Primary Keys.

solved Oracle: Multiple joins with group by [closed]