RE: SQL Question
Posted in 2000
Topics: SQL Development & Query Writing
SELECT colA, count(*)
FROM TabA
WHERE ColA = X
OR ColA = Y
GROUP BY ColA
OR
SELECT count(*)
FROM TabA
WHERE ColA = X
OR ColA = Y
Depending on what you are trying to do
> -----Original Message-----
> From: Tomasz Baron [mailto:tomasz_baron@banpol.pl]
> Sent: 06 June 2000 09:11
> To: informix-list@iiug.org
> Subject: SQL Question
>
>
> 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
>
>
>
___________________________________________________________________________
This email is confidential and intended solely for the use of the
individual to whom it is addressed. Any views or opinions presented are
solely those of the author and do not necessarily represent those of
Sema Group.
If you are not the intended recipient, be advised that you have received this
email in error and that any use, dissemination, forwarding, printing, or
copying of this email is strictly prohibited.
If you have received this email in error please notify the Sema Group
Helpdesk by telephone on +44 (0) 121 627 5600.
___________________________________________________________________________
I want two counts in one statement with two different where filters!!!
Maybe it looks alike this:
SELECT a.count(*), b.count(*) from TabA a, TabA b where
a.ColA=X and b.ColB=Y
but.. this is not the right one.
"COOPER, Joseph" <Joseph.COOPER@sema.co.uk> wrote in message
news:8hiko7$k39$1@news.xmission.com...
>
> SELECT colA, count(*)
> FROM TabA
> WHERE ColA = X
> OR ColA = Y
> GROUP BY ColA>
> OR
> SELECT count(*)
> FROM TabA
> WHERE ColA = X
> OR ColA = Y>
> Depending on what you are trying to do
>
>
> > -----Original Message-----
> > From: Tomasz Baron [mailto:tomasz_baron@banpol.pl]
> > Sent: 06 June 2000 09:11
> > To: informix-list@iiug.org
> > Subject: SQL Question
> >
> >
> > 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
> >
> >
> >
>
>
___________________________________________________________________________
> This email is confidential and intended solely for the use of the
> individual to whom it is addressed. Any views or opinions presented are
> solely those of the author and do not necessarily represent those of
> Sema Group.
> If you are not the intended recipient, be advised that you have received
this
> email in error and that any use, dissemination, forwarding, printing, or
> copying of this email is strictly prohibited.
>
> If you have received this email in error please notify the Sema Group
> Helpdesk by telephone on +44 (0) 121 627 5600.
>
___________________________________________________________________________
>