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

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() query help

2010-08-13 Thread Richard Quadling
On 13 August 2010 13:43, Ron Piggott 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 > `bible_concordance_word_refer

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) {

Re: [PHP-DB] Count Many Records

2006-06-28 Thread Chris
Kevin Murphy wrote: 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 NE

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 data1

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)

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

2004-06-08 Thread Ignatius Reilly
Here is how I would do: 1. Group your visits by IP, order them in time and give each row a sequential number starting with 1 (not completely trivial - exercise left to the reader) Now you have a temporary table T ( ip, timestamp, rank ) 2. Join the table to itself on two consecutive rows, and co

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

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. --- code in check_visits.php $sql = "SELECT COUNT(visitdate) FROM cardlist GROUP BY visitdate"; $query = mysql_query($sql) or die(" Cannot query the database

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 "Total number of visits: $visitcount"; // <

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

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 & AVG

2003-09-05 Thread John W. Holmes
Shaun wrote: 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? Learn SQL, please. SELECT COUNT(co

Re: [PHP-DB] Count database-values

2003-06-10 Thread Becoming Digital
Becoming Digital'" <[EMAIL PROTECTED]>; <[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

RE: [PHP-DB] Count database-values

2003-06-10 Thread Hutchins, Richard
use the index number 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 PROTECTE

Re: [PHP-DB] Count database-values

2003-06-10 Thread Becoming Digital
t; <[EMAIL PROTECTED]> To: "'Becoming 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

RE: [PHP-DB] Count database-values

2003-06-10 Thread Ford, Mike [LSS]
> } > > Edward Dudlik > Becoming Digital > www.becomingdigital.com > > > - Original Message - > From: "Becoming Digital" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, 10 June, 2003 06:43 > Subject: Re: [PHP-DB] Count databa

Re: [PHP-DB] Count database-values

2003-06-10 Thread Becoming Digital
igital www.becomingdigital.com - 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. &g

Re: [PHP-DB] Count database-values

2003-06-10 Thread Becoming Digital
> 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 = "SELECT SUM(bedrag) AS Total FROM finance WHERE posneg = 'af'"; > > any suggestions how to do? I want to store it in a variabele ($total) > so I can echo it. (E.

Re: [PHP-DB] Count and group ?

2002-05-01 Thread Tony James
Hi Dave Assuming you are using mysql try the following query select count(Admin_id) as admin1, Admin_id as admin2 from TABLE_NAME group by admin2 substituting TABLE_NAME for whatever you have called your table. Hope this helps Cheers Tony James - Original Message - From: "Dave

RE: [PHP-DB] Count and group ?

2002-05-01 Thread Ryan Marrs
assuming these are your fields: post_id admin_id code would look something like: admin_id; print("Admin $i has $Admin[$i] posts."); } ?> ___ Ryan Marrs Web Developer Sandler & Travis Trade Advisory Services, Inc. 248.474.7200 x 183 248.4

Re: [PHP-DB] count

2002-04-11 Thread Mike
; Sent: Thursday, April 11, 2002 6:52 AM 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, Cro

Re: [PHP-DB] count

2002-04-11 Thread Mike
SELECT SUM(column) as somename FROM table; Mike - Original Message - From: "Ron Allen" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, April 11, 2002 6:52 AM Subject: [PHP-DB] count > I would like to count all the total records from a database. How would I go > about doing

Re: [PHP-DB] count from the results

2002-02-09 Thread olinux
USe the count() function in mysql. Like this: $query = "SELECT count(artist) as howmany FROM artist WHERE artist LIKE 'b%' GROUP BY artist ORDER BY artist ASC"; $result = mysql_query($query) or die("Select Failed!"); echo "Total Number Of Artists In \"B\":  "; echo mysql_num_rows($resul

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

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 c

Re: [PHP-DB] Count

2002-01-16 Thread Miles Thompson
Barry, Before leaping to the wrong conclusion, what exactly do you want to count? You can derive the number of times a page has been fetched from your web logs. Alternately, you could add a table to your database, and at the top of the page the link points to, after you've established your da

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 m

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. D

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 (http://www

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 n

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:[EMAI

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' Bette

Re: [PHP-DB] count function?

2001-03-30 Thread DC
Thanks i will give that ago. "Andrei Skorokhod" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > 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 t

RE: [PHP-DB] count function?

2001-03-30 Thread Larry Rivera
try mysql_num_rows function -Original Message- From: DC [mailto:[EMAIL PROTECTED]] Sent: Friday, March 30, 2001 9:34 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] count function? Hi All I cant quite work out how to count the number of rows in my mysql db that match a certain critieria and

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, ph

Re: [PHP-DB] count function?

2001-03-30 Thread DC
al 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 m

RE: [PHP-DB] count function?

2001-03-30 Thread Larry Rivera
-Original 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 messag

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... to