Skip to content
Loading
  • Nilesh Shah
    +1
    I think you need to use "HAVING" clause
     
    when you have to apply condition on a group then use "having"
     
    e.g. 
    1. Select   
    2.     table_a.Student_id,  
    3.     table_a.name,  
    4.     sum(table_b.amount)   
    5. From   
    6.     table_a   
    7.         left outerjoin  
    8.     table_b   
    9.         on table_a.Student_id = table_b.student_id   
    10. Group by   
    11.     table_a.Student_id  
    12. Having  
    13.     table_a.Student_id = "232" 
     
    +1
  • Thennarasu N
    0
    1. /* your Should use where conidtion apply condition u which ever you want search i mentiion  code used id u can using name and address. but must  which value  going to search this value  its should available in  the database table */

    2. select table_a.Student_id,table_a.name,sum(table_b.amount) from table_a left outerjoin  
    3. table_b on table_a.Student_id=table_b.student_id where   table_a.Student_Id =2  
    4.  group by  
    5.  table_a.Student_id  
    0