List:General Discussion« Previous MessageNext Message »
From:Barry Date:June 10 1999 2:32pm
Subject:Re: COUNT() - Explain please
View as plain text  
Hi All,
I am confused about something, although I have used it in the past, I don't
understand why it worked !!!  :)

The following snippet from another's question provides a good example:

> mysql_query(&sock, "select count(*) from products")
> result = mysql_store_result(&sock))
> oneRow = mysql_fetch_row(result);
> printf("%d", oneRow[0]);

colum[0] of oneRow holds the result from "Count(*)". Why is this? Is there
a general explaination of this in the docs somewhere? Is it just an SQL
rule to follow when using different functions in a query?

I've seen others use "Select Count(*) as thecnt" then reference the return
as the variable "thecnt". How is this done?

Suppose I had two or three functions returning results, how would I
reference the return values from each?

Thanks very much,

COUNT()Net-Lynx10 Jun
Re: COUNT()Jorge Santos10 Jun
  • Re: COUNT() - Explain pleaseBarry10 Jun
    • Re: COUNT() - Explain pleasePaul DuBois10 Jun
      • Re: COUNT() - Thanks everyoneBarry11 Jun
Re: COUNT() - Explain pleaseJim Faucette10 Jun