SQL Question
Date: 1996/08/13
Message-ID: <Pine.HPP.3.93.960813140951.10800D-100000_at_mailgate>#1/1
Let's say I have the following two tables
TableA
TableB
(IdStr) is the primary key of TableA. (IdStr, Seq) is the primary key of
TableB. I need to have output that looks like the following
This would have the merchant and counts of all the entries in TableB that
have a certain status.
If it was just a count of one type of status the query would be:
select TableA.merchant,
count(TableB.status)
IdStr
merchant
IdStr
Seq
status
Merchant Created Pending Acceptance Accepted
-------- ------- ------------------ --------
from TableA,
TableB
where TableA.IdStr = TableB.IdStr and
TableB.status = 'Created'
group by TableA.merchant;
My question is how do I get a serious of counts into one select statement so that I can count all the statuses for one merchant?
Thanks,
Heather
Received on Tue Aug 13 1996 - 00:00:00 CEST