sql - Insert values in a table based on another table -


I need to write the stored procedure. I have a table with some data, Need to insert

example:

  Table 1 name class mathematical physics English Alok V60 50 45 Bobby V78 87 86 Chandini VIII 56 56 56 Dolly VII 87 56 66   

Based on this condition

  Enter the value in Table 2 if class = V (Table 2. Physics = Table 1 Select Table (Table 1. Physics) where classes like "Table 2. Maths = 0 and Table 2. English = 0) if Class = VI (Table 2. Maths = Select Yoga) (Table 1. Maths) Table 1 From class where class classes like table 2. Physical = 0 and table 2. English = 0) If class = 6 (table 2) English = Select from the table 1 amount (Table 1. English) where a "Sixth" table like class 2. Physical = 0 and table 2. Maths = 0)]   

  Table 2 class Math Physics English V. 137 0 Sixth 56 0 7 6 6 6 0 / <>   

Please help me

Select the table 2 class, insert (case WHE n square = 'V' then physics ELSE 0 END), SUM (case when class = 'VI' then Mathematics ELSE 0 END), SUM (Case when Class = 'VII' then English ELSE 0 END) Table 1 group with Class

Comments