SyntaxFix
Write A Post
Hire A Developer
Questions
At times it is quite handy to get the auto increment primary key (id) of the row if it exists and 0 if it doesn't.
id
0
Here's how this can be done in a single query:
SELECT IFNULL(`id`, COUNT(*)) FROM WHERE ...