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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Help need with query

Author  Topic 

johnn_king
Starting Member

2 Posts

Posted - 2005-09-07 : 02:20:02
Hi All,

Would be great if someone can help me with this query.

I have the following tables

1.<email_tracking>

assign_agent transfer_agent replied_agent
================================================
henrychua ut23sorter henrychua
ut23sorter ut23tester09 ut23sorter
ut23tester09 <null> <null>



2. <agent_name>

agent_id
============
henrychua
ut23sorter
ut23tester09


Now with these tow table is I am trying to get this output

AgentNAme Assigned Replied Transferred
=============================================================
henrychua 1 1 1
ut23sorter 1 1 0
ut23tester09 1 0 1


How can I achieve the above output? can some help me with the query

I wrote this query to get the assigned and replied

select email_tracking.assign_agent As AgentName,
count(email_tracking.assign_agent) As Assigned,
count(email_tracking.replied_agent) As Replied
from email_tracking,agent_name
where email_tracking.assign_agent=agent_name.agent_id
group by email_tracking.assign_agent
order by email_tracking.assign_agent asc

I am having trouble getting the transferred count.

can someone plz help!

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-09-07 : 03:17:18
Hi Johnn_King, how did you come up with the numbers?

It'll be easier to help you if you can provide that info

--------------------
keeping it simple...
Go to Top of Page

johnn_king
Starting Member

2 Posts

Posted - 2005-09-07 : 03:59:28
I was trying to give an example.

My requirment is I need to get the details of

1.agent_name
2.no.of emails assigned to him
3.no.of emails replied by him
4.no.of transfer made by him

the above nee dto be done using the tables <email_tracking> and <agent_name>

I am able to get the assigned and replied count. But I am not able to get the transfer name using the same query (the transfer name is always different from the assign name).

Go to Top of Page
   

- Advertisement -