List:General Discussion« Previous MessageNext Message »
From:Douglas Brantz Date:April 2 1999 9:57pm
Subject:Re: Counting rows returned from a SELECT with perl DBI.
View as plain text  
I use Count(*) all the time in returning stats for a web page.
Try count('field') from 'table name' where 'field1'=\"value\"
AND 'field2'=\"value\" AND 'field3'=\"value\" ";

If you want to use the same field and check certain values you can use use the
same field with all the AND statements or use an OR statement
for example;
Count('field') from 'table name' where 'field1'=\"value\" AND
('field2'=\"value1\"
OR 'field2'=\"value2\" OR 'field2'=\"value3\")" ";

Hope this is right and makes sense.  I'm new at this stuff, I almost bought a
CGI/Perl book today but I can find so many answers on-line, not sure if it is
worth buying a book?

Is there on-line training for CGI/PERL - some kind of distance learning program
on the computer- in my case dunce learning.

Thanks,

Douglas


Vivek Khera wrote:

> >>>>> "BS" == Brian Seitz <bds215@stripped> writes:
>
> BS> Oh, sorry.  I forgot to mention that my SELECT statement has about five
> BS> WHERE conditions in it, so I know that COUNT(*) doesn't work.
> BS> Basically, I suppose I'm asking how can I get the same functionality of
> BS> COUNT that works with WHERE conditions?
>
> You're looking for the COUNT(*) function.  But you already found it,
> just aren't using it.  What makes you think COUNT(*) won't work with a
> WHERE clause?
>
> I'd recommend going out and getting a good book on SQL if you're not
> sure of these things.
>
>                                                                 v.
>
> --
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Vivek Khera, Ph.D.                Khera Communications, Inc.
> Internet: khera@stripped       Rockville, MD       +1-301-545-6996
> PGP & MIME spoken here            http://www.kciLink.com/home/khera/
>
> ---------------------------------------------------------------------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> posting. To request this thread, e-mail mysql-thread1331@stripped
>
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see it,
> e-mail mysql-unsubscribe@stripped instead.

Thread
Counting rows returned from a SELECT with perl DBI.Brian Seitz2 Apr
  • Re: Counting rows returned from a SELECT with perl DBI.Sasha Pachev2 Apr
  • Re: Counting rows returned from a SELECT with perl DBI.Brian Seitz2 Apr
    • Re: Counting rows returned from a SELECT with perl DBI.Vivek Khera2 Apr
  • Re: Counting rows returned from a SELECT with perl DBI.Daniel Koch2 Apr
  • Re: Counting rows returned from a SELECT with perl DBI.Douglas Brantz3 Apr
  • Counting rows returned from a SELECT with perl DBI.Michael Widenius3 Apr