Prev: calling a page for each row
Next: LEFT JOIN query help
From: "Ron Piggott" on 17 Jul 2010 22:15 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_trivia_knowledge_profile_reference` = `my_Bible_trivia_knowledge_profile`.`reference` WHERE `my_Bible_trivia_knowledge_profile`.`ip_address` = '$ip_address'
From: =?UTF-8?B?QW5kcsOpcyBHLiBNb250YcOxZXo=?= on 17 Jul 2010 22:20 SELECT IFNULL(SUM(`my_Bible_trivia_knowledge_questions_answered`.`score`), 0) AS total_score, IFNULL(`my_Bible_trivia_knowledge_profile`.`questions_answered`, 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
From: Ron Piggott on 18 Jul 2010 09:44 Thanks, Ron -- -----Original Message----- From: Andrés G. Montañez <andresmontanez(a)gmail.com> To: ron.piggott(a)actsministries.org Cc: php-db(a)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`.`score`), 0) AS total_score, IFNULL(`my_Bible_trivia_knowledge_profile`.`questions_answered`, 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
|
Pages: 1 Prev: calling a page for each row Next: LEFT JOIN query help |