| Author |
SQL quetsion - how to 'convert' null to zero? (if statement)
|
Peter Primrose
Ranch Hand
Joined: Sep 10, 2004
Posts: 755
|
|
hi all, quick question: is there a possibility to return the value 0 and not NULL from the db? example: Select empl_id, age from myTable result: 1 NULL 2 55 I would like to have: 1 0 2 55 thanks for any pointers [ October 08, 2007: Message edited by: Peter Primrose ]
|
 |
Paul Campbell
Ranch Hand
Joined: Oct 06, 2007
Posts: 338
|
|
COALESCE(column_name,0) Select empl_id, COALESCE(age,0) from myTable This will regardless RDBMS. [ October 08, 2007: Message edited by: Paul Campbell ]
|
 |
 |
|
|
subject: SQL quetsion - how to 'convert' null to zero? (if statement)
|
|
|