Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Urgent Help please

Status
Not open for further replies.

Ahssan

Programmer
Nov 4, 2003
27
KW
Hi All,

I need to make one script query in which i have following task to do.

- Number of Tasks opened by user
- Number of Tasks closed by user from tasks opened
- Value of total tasks opened
- Value of total tasks closed

query should also return username along with each count and sum of the above. If any body out here can help me , would appreciate alooooooot.



 
Need some sort of clue as to what the data looks like.
maybe

select
user_id , name = max(users.name) ,
opened = sum (case when action = 'open' then 1 else 0 end) ,
closed = sum (case when action = 'open' then 1 else 0 end)
from tasks join users on tasks.user_id = users.user_id
group by user_id



======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top