Bug #16826 SQL_CALC_FOUND_ROWS and NULLs
Submitted: 27 Jan 2006 3:04
Reporter: Peter Larb Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version:5.0x OS:UNIX
Assigned to: CPU Architecture:Any

[27 Jan 2006 3:04] Peter Larb
Description:
Good afternoon

I would like "SQL_CALC_FOUND_ROWS" to return ZERO if the select query returns a NULL

select SQL_CALC_FOUND_ROWS *
from tABLE X
where ID = 1

If FOUND_ROWS() >1 then

ELSE

END IF;

At the moment it SEEMS that when "FOUND_ROWS()" is performed on a NULL it errors and thus my "ELSE" statement does NOT get called.

I would prefer "FOUND_ROWS()" to return ZERO.

Just like it would have if I had used the "Count()" function.

Peter

How to repeat:
Perform FOUND_ROWS()  on a row where the records returned is NULL

Nothing is returned