For example, i have an empty table ‘A’ with columns: number(INT) and id.
I know that in MySQL null + number returns null. However there is workaround using IFNULL function:
SELECT IFNULL(NULL, 0) + @number
would return @number. But if I try to select from an existing table, results are not the same:
SELECT IFNULL(number, 0) + @number FROM A
gives me a result with no rows selected.
How can i get MySQL to display one row with ‘number’ being a number, so I could insert minimal @number using REPLACE statement into table A?
Maybe there is another way..?
If this is indeed some aggregate function then something along these lines will always return 1 row
Reading your comment I think you want
Select min of a table (0 or 1 row), combine that with a row with a fixed number then sum those 1 or 2 rows: