join - SQL difference Calculation from two table or views -


i have supervisor table , no. of working days=5.i have absent tabale.now calculate present days 2 table.how this.

 suplist    workdays     101         5     102         5     103         5     104         5     105         5  suplist   absentdays     101         2     103         1 

now want this

suplist      presentdays 101         3 102         5 103         4 104         5 105         5 

select s.suplist , (s.workdays - isnull(a.absentdays,0)) presentdays supervisertable s left join absenttable on s.suplist=a.suplist 

sql fiddle


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -