I have a table with null values and datatypes for all columns are integer/real. I'd like to write 'no data' if the field is null when writing the data to csv.
Here is the testTable.
id test1 test2 test3
------ ------ ------ ------
1 1 2 3
2 5 6
3 7 9
4 11 12
I'd like to only display 'string' in column test1 where id is 2. My sql statement is
SELECT id, (ifnull(test1, 'string')) as test1, test2, test3 from testTable;
and it produces this.
id test1 test2 test3
------ ------ ------ ------
1 1 2 3
2 string 5 6
3 7 9
4 string 11 12
Is there a way to put condition clause for ifnull or is there another way of producing this final table?
My desired final testTable.
id test1 test2 test3
------ ------ ------ ------
1 1 2 3
2 string 5 6
3 7 9
4 11 12
Thank you.