Top "Ifnull" questions

This tag refers to the process of determining whether or not a particular object is null, and then running certain code based off of that condition.

MySQL IFNULL ELSE

I have a select statement where I want to make the select conditional like this: IFNULL(field_a, field_a, …

mysql select ifnull
sqlite IFNULL() in postgres

What is the equivalent of SQLite's IFNULL() in Postgres? I have to following query (sqlite in Ruby): SELECT ifnull(max(…

postgresql sqlite ifnull
In MySQL, which is more efficient: IFNULL or NULLIF?

These two MySQL functions do the same thing: IFNULL(column_name, 'test') = 'test' or NULLIF(column_name, 'test') IS NULL …

mysql ifnull null-test
How does MySQL CONCAT IFNULL work with more than two values?

I need to CONCAT two fields, if they both exist and add parentheses around the second field. Otherwise I just …

mysql concatenation concat ifnull
How can i use IFNULL in Where clause

I want to use IFNULL() in such a way that I can select the record containing NULL or, if a …

mysql sql ifnull
MySQL IFNULL question

I have a query which contains a subquery which is something like this IFNULL((SELECT id FROM mytable WHERE id = 1), …

mysql ifnull
symfony2 doctrine select IFNULL

Ok i have this code: SELECT IFNULL(s2.id,s1.id) AS effectiveID, IFNULL(s2.status, s1.status) AS effectiveStatus, …

symfony doctrine query-builder ifnull
Using IFNULL to set NULLs to zero

I have a table in which a field contains an integer or NULL. parent_id 2 4 6 NULL NULL 45 2 How would I …

mysql sql ifnull
MySQL, IFNULL(), COALESCE() on String not replacing

My statement should replace every empty title_column with 'no name', but it doesn't: SELECT COALESCE(main_table.title_column, …

mysql sql replace coalesce ifnull
Replace NULL with SUBTOTAL and TOTAL in a ROLLUP

I have tried to use IFNULL to replace the NULL fields returned by ROLLUP for subtotals and totals but it …

mysql rollup totals ifnull