Performing addition of 3 values of a joined query

update total set total.marks= i1.marks1+i1.marks2+i1.marks3

from i1 join total on i1.id=total.id

where i1.id=’stud1′

 

Here,

  1. I am performing update operation
  2. Table names are i1 and total which has a common column id
  3. marks1 , marks2 , marks3 are columns in i1 table
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s