MySQL Forums
Forum List  »  Newbie

Re: Select sum(x) >0 with multiple columns
Posted by: Roland Bouman
Date: August 01, 2005 04:37AM

Whoops, that's right felix, good spot! Seems like the SUM(IF(S1=0,NULL,S1) solution does the job after all.

So, gaute, you probably did execute the mysql_query, but did not test if it returned a valid result resource. You can tell, because an invalid query will return a FALSE resource. In the php examples they do something like:

// Perform Query
$result = mysql_query($sql);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}

//process as usual

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.