NULL to 0
am 18.07.2010 04:15:28 von ron.piggott
What modification does this query need that if either total_score or
questions_answered have a value of "NULL" that it will be changed to 0
("ZERO") Ron
SELECT SUM(`my_Bible_trivia_knowledge_questions_answered`.`score`) AS
total_score, `my_Bible_trivia_knowledge_profile`.`questions_answered` FROM
`my_Bible_trivia_knowledge_questions_answered` INNER JOIN
`my_Bible_trivia_knowledge_profile` ON
`my_Bible_trivia_knowledge_questions_answered`.`my_Bible_tri via_knowledge_profile_reference`
= `my_Bible_trivia_knowledge_profile`.`reference` WHERE
`my_Bible_trivia_knowledge_profile`.`ip_address` = '$ip_address'
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: NULL to 0
am 18.07.2010 04:20:20 von andresmontanez
SELECT
IFNULL(SUM(`my_Bible_trivia_knowledge_questions_answered`.`s core`),
0) AS total_score,
IFNULL(`my_Bible_trivia_knowledge_profile`.`questions_answer ed`, 0)
AS questions_answered
In these cases you must use the IFNULL function, for testing the value.
--
Andrés G. Montañez
Zend Certified Engineer
Montevideo - Uruguay
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: NULL to 0
am 18.07.2010 15:44:52 von ron.piggott
--=-NcLvTGLgQAUKD5bjEfig
Content-Type: multipart/alternative; boundary="=-F++eSMoM27v/3jYVXIh9"
--=-F++eSMoM27v/3jYVXIh9
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Thanks, Ron
--=20
-----Original Message-----
From: Andrés G. Montañez
To: ron.piggott@actsministries.org
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] NULL to 0
Date: Sat, 17 Jul 2010 23:20:20 -0300
SELECT
IFNULL(SUM(`my_Bible_trivia_knowledge_questions_answered`.`s core`),
0) AS total_score,
IFNULL(`my_Bible_trivia_knowledge_profile`.`questions_answer ed`, 0)
AS questions_answered
In these cases you must use the IFNULL function, for testing the value.
--
Andrés G. Montañez
Zend Certified Engineer
Montevideo - Uruguay
--=-F++eSMoM27v/3jYVXIh9
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 7bit
Thanks, Ron
-----Original Message-----
From: Andrés G. Montañez <>
To:
Cc:
Subject: Re: [PHP-DB] NULL to 0
Date: Sat, 17 Jul 2010 23:20:20 -0300
SELECT
IFNULL(SUM(`my_Bible_trivia_knowledge_questions_answered`.`s core`),
0) AS total_score,
IFNULL(`my_Bible_trivia_knowledge_profile`.`questions_answer ed`, 0)
AS questions_answered
In these cases you must use the IFNULL function, for testing the value.
--
Andrés G. Montañez
Zend Certified Engineer
Montevideo - Uruguay
--=-F++eSMoM27v/3jYVXIh9--
--=-NcLvTGLgQAUKD5bjEfig--