Dear MySQL specialists,

this is a MySQL-newbie question: I want to create a view of a table,
where all NULL-values are substituted by 0. Therefore I tried:

SELECT *,
IFNULL(*,0)
FROM table

Unfortunately IFNULL seems  not to accept any wildcards like * as
placeholder for the column-name. REGEXP didn't work either - well maybe
I made a mistake in the syntax?

Everything works fine, when I write an IFNULL-command for every column
in my table:

SELECT *,
IFNULL(b1,0) AS b1,
IFNULL(b2,0) AS b2,
IFNULL(b3,0) AS b3,
...

But beside causing a lot of writing-work, this solution has the problem,
that it doesn't reflect new columns in the original table in the view,
as there is no corresponding IFNULL-command in the view. This is not
acceptable in my case.

So is there a way to use wildcards/regular expressions in IFNULL? Is
there another way to create a view that substitutes every NULL-value with 0?
I'd appreciate any kind of help very much!

Kind regards and greetings from Munich,
Felix

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to