[PHP-DB] COUNT and OUTER JOIN results

2011-05-06 Thread Ron Piggott
The following query returns all 8 prayer request categories with the total # of requests every submitted to each category: SELECT `prayer_request_category`.`reference` , `prayer_request_category`.`category` , COUNT( `prayer_requests`.`reference` ) AS category_request_count FROM

Re: [PHP-DB] COUNT and OUTER JOIN results

2011-05-06 Thread Amit Tandon
Dear Ron Take your condition to ON cluause. So your on clause (for LEFT JOIN) would read something like ON `prayer_request_category`.` reference` = `prayer_requests`.`prayer_request_category_reference` AND `prayer_requests`.`approval_ level` IN ( 1, 3 ) `prayer_requests`.`prayer_request_type` =

Re: [PHP-DB] COUNT and OUTER JOIN results

2011-05-06 Thread Ron Piggott
thank you for explaining this to me Amit. It works. Ron The Verse of the Day “Encouragement from God’s Word” http://www.TheVerseOfTheDay.info From: Amit Tandon Sent: Friday, May 06, 2011 5:49 AM To: Ron Piggott Cc: php-db@lists.php.net Subject: Re: [PHP-DB] COUNT and OUTER JOIN results

[PHP-DB] COUNT() query help

2010-08-13 Thread Ron Piggott
I am making a Bible concordance. I need help with the query that figures out how many times each word is in the Bible. The COUNT() in the query below is giving me the total number of words for the letter of the alphabet, not the specific word, and is causing there to be only 1 search result. I

Re: [PHP-DB] COUNT() query help

2010-08-13 Thread Richard Quadling
On 13 August 2010 13:43, Ron Piggott ron.pigg...@actsministries.org wrote: SELECT `bible_concordance_words`.`reference`, `bible_concordance_words`.`word`, COUNT(`bible_concordance_word_reference`.`bible_concordance_words_reference`) AS occurrences FROM `bible_concordance_words` INNER JOIN

[PHP-DB] COUNT() returns 0 if there were no matching rows. .... really?!

2009-08-06 Thread Govinda
Hi all I am 99.9% sure it is my lack of understanding something, but it sure seems like my PHP/MySQL code is returning something other than what i expect from reading the docs. to explain: this code is serving me (almost perfectly) well:

Re: [PHP-DB] Count Many Records

2006-06-29 Thread Kevin Murphy
Thanks for your help, Chris. You certainly got me going in the right direction. In case anyone is interested, below is the completed solution, with design elements, turned into a function so I can easily call it several times. function counter_maker ($database,$name,$link) {

[PHP-DB] Count Many Records

2006-06-28 Thread Kevin Murphy
Thanks in advance for your help, and forgive me if this is me being bone-headed. :-) The following code works and accomplishes what I need it to do, but I am wondering if there is a better way to accomplish the same task. I have several tables of records and I need to count and then

Re: [PHP-DB] Count Many Records

2006-06-28 Thread dpgirago
Kevin Murphy asks: The following code works and accomplishes what I need it to do, but I am wondering if there is a better way to accomplish the same task. I have several tables of records and I need to count and then display. Even if I could just combine the first three queries (below) into

Re: [PHP-DB] Count Many Records

2006-06-28 Thread Kevin Murphy
Actually the design is in the code below I need to display the counts from all of those queries in a grid. Basically, its just a summary of a bunch of information. Another way to look at it would be a several lines that say something like this: You have $data1_count NEW records in

[PHP-DB] Count unique visits in PHP/MySQL

2004-06-08 Thread veditio
I am making a PHP/MySQL traffic report page from a table that records some user activity using PHP referrer information. I have a table with three rows: IP, page_name, and timestamp. The IP row records the user's IP address, page_name records the name of the page that the user loaded, and the

Re: [PHP-DB] Count unique visits in PHP/MySQL

2004-06-08 Thread Ignatius Reilly
) ) AS unik_visits FROM T LEFT JOIN U ONU.ip = T.ip AND U.rank = T.rank + 1 GROUP BY ip HTH Ignatius _ - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 08, 2004 5:03 PM Subject: [PHP-DB] Count unique

[PHP-DB] COUNT() returns 1, but should be 0

2003-12-21 Thread Lew Mark-Andrews
Hi all, I'm baffled by this. I've put together a rather simple newsletter + greeting card app for a company to send their clients personalized corporate e-mails each containing the URL link to the greeting card page. When the user successfully visits the view card page, my code writes the visit

Re: [PHP-DB] COUNT() returns 1, but should be 0

2003-12-21 Thread Tobey Wheelock
On Mon, Dec 22, 2003 at 11:43:35AM +0900, Lew Mark-Andrews wrote: Table structure for cardlist: `visitdate` datetime default NULL, $sql = SELECT COUNT(visitdate) FROM cardlist GROUP BY visitdate; $visitcount = mysql_num_rows($query); echo pTotal number of visits: $visitcount/pbr; // ---

Re: [PHP-DB] COUNT() returns 1, but should be 0

2003-12-21 Thread John W. Holmes
Lew Mark-Andrews wrote: I get a count of 1 for the number of visits ($visitcount) using my following code. It should be 0. --- snipped code in check_visits.php $sql = SELECT COUNT(visitdate) FROM cardlist GROUP BY visitdate; $query = mysql_query($sql) or die(brbrdiv

Re: [PHP-DB] COUNT() returns 1, but should be 0

2003-12-21 Thread Lew Mark-Andrews
John, That's because you're displaying how many rows were returned from the query, not the value that COUNT() returns. A query with COUNT() is always going to return at least one row. $visitcount = mysql_result($query,0); Yes, that was it! Thank you so much. Lew -- PHP Database Mailing List

[PHP-DB] Count down

2003-09-22 Thread Frank McIsaac
Hi all. I was wanting to make a page that takes a set date and counts down to zero displaying days, minutes, and seconds. Basically, I want it to count down from the current date and time until a future date and time is reached (ie. Sept. 30th is x days, y minutes, and z seconds away

Re: [PHP-DB] Count down

2003-09-22 Thread Peter Beckman
On Mon, 22 Sep 2003, Frank McIsaac wrote: Hi all. I was wanting to make a page that takes a set date and counts down to zero displaying days, minutes, and seconds. Basically, I want it to count down from the current date and time until a future date and time is reached (ie. Sept.

Re: [PHP-DB] Count down

2003-09-22 Thread Peter Beckman
On Mon, 22 Sep 2003, Peter Beckman wrote: On Mon, 22 Sep 2003, Frank McIsaac wrote: Hi all. I was wanting to make a page that takes a set date and counts down to zero displaying days, minutes, and seconds. Basically, I want it to count down from the current date and time until a

[PHP-DB] COUNT AVG

2003-09-05 Thread Shaun
Hi, Is it possible to combine the COUNT AVG functions using MySQL? I have a table called Bookings and I need to find out the average number of bookings. So I need to count the number of bookings in the table and then get the Average, is this possible? Thanks for your help -- PHP Database

[PHP-DB] Count database-values

2003-06-10 Thread Robert Wanadoo
Hi everybody, I've got a little problem, which I can't solve. It is as follow: In my database I made a table with different fields. One of the fields is named 'bedrag' and contains a numeric value like 15.47 or 78.16 and so on. If I want a value of the table I use in most cases the following

Re: [PHP-DB] Count database-values

2003-06-10 Thread Becoming Digital
out of your result set. It's a common mistake. :) Edward Dudlik Becoming Digital www.becomingdigital.com - Original Message - From: Robert Wanadoo [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, 09 June, 2003 11:40 Subject: [PHP-DB] Count database-values Hi everybody, I've got

Re: [PHP-DB] Count database-values

2003-06-10 Thread Becoming Digital
- Original Message - From: Becoming Digital [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, 10 June, 2003 06:43 Subject: Re: [PHP-DB] Count database-values So far no problems, but I want to count all these values. I tried with SUM but with the following code it doesn't work

RE: [PHP-DB] Count database-values

2003-06-10 Thread Ford, Mike [LSS]
- From: Becoming Digital [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, 10 June, 2003 06:43 Subject: Re: [PHP-DB] Count database-values So far no problems, but I want to count all these values. I tried with SUM but with the following code it doesn't work: $squery

Re: [PHP-DB] Count database-values

2003-06-10 Thread Becoming Digital
Digital' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, 10 June, 2003 11:54 Subject: RE: [PHP-DB] Count database-values -Original Message- From: Becoming Digital [mailto:[EMAIL PROTECTED] Sent: 10 June 2003 12:15 I screwed up my own code. Silly me. It should read: Surely your

RE: [PHP-DB] Count database-values

2003-06-10 Thread Hutchins, Richard
instead of the column name as the documentation recommends, the performance should be just fine. Hope this helps. Rich -Original Message- From: Becoming Digital [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 10, 2003 12:50 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Count database

Re: [PHP-DB] Count database-values

2003-06-10 Thread Becoming Digital
]; [EMAIL PROTECTED] Sent: Tuesday, 10 June, 2003 13:14 Subject: RE: [PHP-DB] Count database-values Edward, Have you considered trying mysql_result()? It appears that your query is going to always return a single piece of data: Total. So you essentially have an array with only a single element. If you

[PHP-DB] Count AND sum columns values

2003-01-20 Thread Cesar Aracena
Hi all, I have this table which stores products and quantities ordered by customers, and for billing purposes, I need to fetch not only how many products but also how many where ordered for each one but not detailed, but as one big result, so later I can charge for individual gift packages and

[PHP-DB] count hours from 2 dates

2002-10-01 Thread José Moreira
hello, um using this SQL string : SELECT computer, date, closedate,UNIX_TIMESTAMP(closedate), UNIX_TIMESTAMP(date), (UNIX_TIMESTAMP(closedate) - UNIX_TIMESTAMP(date)) / POW(60,2) FROM tracking (18 Records) computer date closedate UNIX_TIMESTAMP(closedate)

[PHP-DB] Count and group ?

2002-05-01 Thread Dave Carrera
Hi All I have added a row to my table which inputs which admin user has amended a record in a table on my db. I have this working but what I would like to do is count how many instances of the admin id I have stored. So if my list looks like this.. Admin_id 1 2 2 2 3 3 3 3

RE: [PHP-DB] Count and group ?

2002-05-01 Thread Ryan Marrs
. 248.474.7200 x 183 248.474.8500 (fax) www.strtrade.com -Original Message- From: Dave Carrera [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 01, 2002 8:03 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Count and group ? Hi All I have added a row to my table which inputs which admin user

Re: [PHP-DB] Count and group ?

2002-05-01 Thread Tony James
Carrera [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 01, 2002 1:02 PM Subject: [PHP-DB] Count and group ? Hi All I have added a row to my table which inputs which admin user has amended a record in a table on my db. I have this working but what I would like to do is count how

Re: [PHP-DB] count

2002-04-11 Thread Mike
Subject: RE: [PHP-DB] count Something like this Select sum(ID) name from $table; Where name is some name that I come up with? Ronald L. Allen (MCSE NT, MCP, CCNA) SR. LAN/WAN Administrator SFOR - Hungary, Croatia [EMAIL PROTECTED] [EMAIL PROTECTED] +36-82-50 ext. 22580 DSN: 760

Re: [PHP-DB] count from the results

2002-02-09 Thread Jason Wong
On Sunday 10 February 2002 00:55, Barry Rumsey wrote: I have the following code: $query = SELECT * FROM artist WHERE artist LIKE 'b%' ORDER BY artist ASC; [snip] What I would like to know is how do I do a count on each result returned.e.g. Benny(4) , Bill(10) Try: $query = SELECT artist,

[PHP-DB] Count

2002-01-16 Thread Barry Rumsey
How do you add a count feature to a link. I can get stuff from the db but want to know how many times it's been read or click on?

Re: [PHP-DB] Count

2002-01-16 Thread Miles Thompson
Afterthought -- you could make this self-maintaining by doing a select for $PHP_SELF and inserting the record if mysql_num_rows() returned 0. Downside is that it would add greatly to the overhead. Miles At 04:42 PM 1/16/2002 -0400, Miles Thompson wrote: Barry, Before leaping to the wrong

[PHP-DB] count

2002-01-10 Thread Barry Rumsey
I'm trying to do the following query: $db_connect = mysql_connect($sqlhostname,$login,$password); $base_selection = mysql_select_db($base,$db_connect); $query = SELECT DISTINCT * FROM xp_topics WHERE artist_count='artist' AND topictext LIKE 'A%' ORDER BY artist_count ASC limit 0,5;

Re: [PHP-DB] count

2002-01-10 Thread Miles Thompson
Barry, I can't see where you've created $topictest. Maybe, just before you define $queyr2, you should have the line $topictest = $row[ topcitext]; I also think xp_stories_topicid should be xp_stories.topicid Try echo 'ing $query2 and see what is printed. Hope this helps, and that I've not

[PHP-DB] count query

2002-01-08 Thread Barry Rumsey
Is it posible to do a count(*) on a tabe where id=2 and count just those that id = 2

Re: [PHP-DB] count query

2002-01-08 Thread DL Neil
Barry, Is it posible to do a count(*) on a tabe where id=2 and count just those that id = 2 =why don't you try it? The answer is yes, because count(*) means count the entire number of non-null rows selected. See manual: 3.3.4.8 Counting Rows =dn -- PHP Database Mailing List

Re: [PHP-DB] count query

2002-01-08 Thread Daniel Barton
Hi, SELECT SUM(IF(id = '2',1,0)) AS field_name FROM table Versatile command - you can use it for quite a lot of things. Barry Rumsey wrote: Is it posible to do a count(*) on a tabe where id=2 and count just those that id = 2 -- -- Dan Barton Terrestrial Program Biologist Asst.

Re: [PHP-DB] count function?

2001-03-30 Thread DC
Ok i think i need to expand my help request... my fault I have a db that uses ids for topics in a message board ie each topic has messages of various numbers in them. From my select a topic page i hope to put the number of messages in the topic, so it visually looks like this sort of...

RE: [PHP-DB] count function?

2001-03-30 Thread Larry Rivera
Message- From: DC [mailto:[EMAIL PROTECTED]] Sent: Friday, March 30, 2001 9:53 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] count function? Ok i think i need to expand my help request... my fault I have a db that uses ids for topics in a message board ie each topic has messages of various

Re: [PHP-DB] count function?

2001-03-30 Thread DC
30, 2001 9:53 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] count function? Ok i think i need to expand my help request... my fault I have a db that uses ids for topics in a message board ie each topic has messages of various numbers in them. From my select a topic page i hope t

RE: [PHP-DB] count function?

2001-03-30 Thread Brian S. Dunworth
At 10:06 AM 3/30/01 -0800, Larry Rivera wrote: I think you have to run multiple queries, ie run some loop after finding out what topics you wil count from e== run a select distinct to get the topics run a while or for loop then run queries again like count(*) where topic='$topic' Better yet

Re: [PHP-DB] count function?

2001-03-30 Thread DC
Cheers Brian Thats sounds more like i am looking for Although i have put the other code examples offered for this prob in my code folder for later cause you never now when you'll need them. Cheers Dave C ""Brian S. Dunworth"" [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL

Re: [PHP-DB] count function?

2001-03-30 Thread Phil Jackson
What is retrieved if you do a Select Count(*) from myDb where condition = parameters? Seems your result set should contain this value... Phil J. DC wrote: Hi All I cant quite work out how to count the number of rows in my mysql db that match a certain critieria and the show that number

Re: [PHP-DB] count function?

2001-03-30 Thread Andrei Skorokhod
if you just need the number SELECT COUNT(*) FROM table where At 06:34 PM 3/30/2001 +0100, DC wrote: Hi All I cant quite work out how to count the number of rows in my mysql db that match a certain critieria and the show that number numericaly in my pages. Checked books,