RE: SQL Question
Posted in 2000
If it just HAS to be in one row:
select (select count(*) from TabA where ColA = X),
(select count(*) from TabA where ColA = Y)
from systables where tabid = 1
though I don't see much advantage to it.
> -----Original Message-----
> From: Richard harnden [SMTP:harndr@russelleurope.com]
> Sent: Tuesday, June 06, 2000 8:23 AM
> To: tomek@ampr.gliwice.pl; informix-list@iiug.org
> Subject: Re: SQL Question
>
> There has to be a better way, but ...
>
> SELECT count(*) x_count, 0 y_count
> FROM TabA
> WHERE ColA = X
> UNION
> SELECT 0, count(*)
> FROM TabA
> WHERE ColA = Y
> INTO TEMP t_xyzzy WITH NO LOG;>
> SELECT SUM(x_count), SUM(y_count)
> FROM t_xyzzy;
>
>
> >>> "Tom" <tomek@ampr.gliwice.pl> 06/06/00 10:03am >>>
> Statement have to return 1 row!! (with two columns)
>
>
> "gignez P." <gignez.pascal@siemens.be> wrote in message
> news:8hicui$dn5$1@news.mch.sbs.de...
> > If you want the grand total, just use
> >
> > select count(*) form TabA where ColA in(X, Y);> >
> > if you want each subtotal
> >
> > select count(*) form TabA where ColA in(X, Y)
> > group by ColA;> >
> > this last one returns 2 rows.
> >
> > Tomasz Baron <tomasz_baron@banpol.pl> a Tcrit dans le message :
> > Hm2%4.3380$qi.88060@news.tpnet.pl...
> > > How to combine into a single question something like this:
> > >
> > > select count(*) from TabA where ColA=X;
> > > select count(*) from TabA where ColA=Y;> > >
> > >
> > >
> > > Thanks for all answers
> > >
> > >
> > >
> >
> >
>
>