In my select I am using this in order to convert an integer to a money form.
CAST(mytable.discount AS money) AS Discount
But I cannot figure out how to avoid the 'NULL' output if the join fails (for good cause) to bring the optional value.
I've done this to avoid NULLS in the past:
COALESCE(mytable.voucher,'----') AS Voucher
But I cannot figure out how to combined CAST and COALESCE for the same field. I just want my discount NULL fields to be '----'
COALESCE(CAST(mytable.discount AS money), '-----')'---'is a character value,discountis a number. You can't have different datatypes for the same column. You would need to convert all numbers to a string as value (e.g. usingto_char())