|
Posted by Simon Hayes on 09/06/05 18:03
Assuming that there is only one possible officer and dispatcher for
each LogID, then you could do this:
select
count(a.LogID) as LogCount,
max(a.LogDispatcherID),
max(b.OfficerFirstname + ' ' + b.OfficerLastname) as
OfficerName
from
dbo.[Log] a
join dbo.Officer b
on a.LogAssigned1 = b.OfficerID
Group By
a.LogID
However, that may not be what you want, depending on what your data
looks like, if there can be several officers or dispatchers for each
LogID etc. So if this isn't helpful, or gives you the wrong answer, I
suggest you post CREATE TABLE and INSERT statements to set up a simple
test case - that way others can copy and paste into QA to test it.
http://www.aspfaq.com/etiquette.asp?id=5006
Simon
Navigation:
[Reply to this message]
|