Re: Count Question
Posted in 1999
I'm sorry I did'nt catch the output until after I had replied. I believe if you
just ORDER BY id it should be close to the output you want. As for the counts I
still think you'll need 2 select statements.
Mark Roach wrote:
> You will have to use 2 selects, but you could have both in 1 sql.
> Example:
> UNLOAD TO "output1.out"
> SELECT count(*) from employee
> WHERE id IN ("A", "B")>
> UNLOAD TO "output2.out"
> SELECT count(*) from employee
> WHERE id IN ("C", "D")>
> kjacobs@pharmacy.com wrote:
>
> > I have a table that lists employees by an identifier (BWE1, BWN1, BWE2, or
> > BWN2) See Below for example. What I want like to do is get a count of all
> > (BWE1 and BWN1) and a count of all (BWE2 and BWN2) employees. I.E. I just
> > want two results. I have done this using two different querys, but I would
> > like to make it into one. Does anyone have any clues on how this can be
> > done?
> >
> > I would like to make these two querys into one.
> >
> > SELECT COUNT(*) bw, id, FROM employee WHERE id IN("BWE1, BWE1") GROUP BY id
> > SELECT COUNT(*) bw, id, FROM employee WHERE id IN("BWE2, BWE2") GROUP BY id> >
> > EXAMPLE TABLE
> > empnumber, id
> > 1, BWE1
> > 2, BWN1
> > 5, BWE2
> > 6, BWN2
> >
> > -----------== Posted via Deja News, The Discussion Network ==----------
> > http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
>
> ------------------------------------------------------------------------
>
> Mark Roach <mroach@bju.IT5_PO>
> Informix Programmer
> Bob Jones University
>
> Mark Roach
> Informix Programmer <mroach@bju.IT5_PO>
> Bob Jones University
> Netscape Conference Address
> Netscape Conference DLS Server
> Additional Information:
> Last Name Roach
> First Name Mark
> Version 2.1