Re: SQL Question

From: Randy Dewoolfson <randyd_at_cais3.cais.com>
Date: 1996/08/17
Message-ID: <4v5kt9$pek_at_news2.cais.com>#1/1


If i understanfd the question, you need to NOT put the STATUS= line in the where clause, and you DO put GROUP BY STATUS at the end.

Good Luck
Randy :)

Heather Dyson (dyson_at_template.com) wrote:

: Let's say I have the following two tables
 

: TableA
: ------
: IdStr
: merchant
 

: TableB
: ------
: IdStr
: Seq
: status

: (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
 

: Merchant Created Pending Acceptance Accepted
: -------- ------- ------------------ --------

: 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)
: 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

--
    ..uu.                                     ----------------------
  .?$" '?i     .                              I  Randy DeWoolfson  I
 .T^M  ._at_"    d9    .     f   ,.un.  b,    i  I--------------------I
 "  Z :#"    M `8   U    <  .dP"``"# `M   _at_"  I  randyd_at_cais.com   I
    &H?`    Xl _R   $5.  $  ?*    _at_   'P,#"   I--------------------I
  ,d#^*L   :RP'~$b  f`$L:M  Xf  .f'    dH`    I        ,\//.       I
    &  'M ,P    `E  M   "$  Mux~      n!`     I        |o o|       I
   dk   `h"       ' j     " y"       *~       I====oOO==(_)==Ooo===I
Received on Sat Aug 17 1996 - 00:00:00 CEST

Original text of this message