Abhishek_Boga -1 Newbie Poster

Hi,,.. Need hlpe on this.

I have 2 columns Oldvalue and newvalue. I want to create a store procedure where the query will be as if oldvalue and new value have record, but both the records are not same then 'change' variable should increment by 1 for each computername, again if oldvalue is having nullvalue and newvalue has record then 'add' variable should increment by 1 for each computername, same if oldvalue has record and newvalue has no record then 'remove' variable should increment by 1 for each computername. Also want to calculate the grantotal as shown below:

example:

name add change remove grand total
abc 1 1 0 2
pqr 0 2 1 3
sdf 2 1 1 4

This was my first query
My second query is I want to count the 'add' and 'remove' column as shown below from the above data only:

add 3
remove 2

Kindly help me out to get out of this problem