Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
enak
Starting Member
34 Posts |
Posted - 2006-04-25 : 14:19:58
|
| I am using vb.net to gather some data from an MS SQL 2000 database. I create a datatable and populate it with a list of sales people in the first column.Next, I want to be able to retrieve the sales totals for each person for the given day. So, for my example here, there are 20 rows and there are enough columns to list the totals for each day of the month up to today.The case is coming up where not everyone is selling on each day so when I retrieve the sales total for a certain day I may only get the totals for 18 of the sales people. Here is my sql:select interviewer, CASE WHEN count(*) IS NULL THEN 0 ELSE count(*) END As Interviews from interview Where int_date = '4/20/2006' Group By Interviewer order by interviews DescHere is what I want to see:interviewer InterviewsA 10B 11C 9D 3E 17F 0G 0H 2I 12J 0K 9L 4M 5N 3O 1P 0Q 8R 4S 5T 0If one of the sales people do not have any totals for the given day I want to show a zero.How can I do this?Thanks,enak |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-04-25 : 14:34:09
|
| try isnull((count(*)),0 )Srinika |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-04-25 : 18:19:37
|
do you have a table contains all the interviewer ?use it to left join to this table KH |
 |
|
|
|
|
|