سؤال

I want to get 0 instead of null in my select query.

I mean currently my query is showing NULL for amount column if there are no entry in table.

Can I get 0 for amount column in select query if it has NULL?

هل كانت مفيدة؟

المحلول

You can try like this:

select isnull(column,0)

Can I get 0 for amount column in select query if it has NULL?

Yes you can get. If you will show your exact table and column name then it would be the best else you can try like this:-

select isnull(amount,0) as Amount from MyTable

On a side note:-

You may also check out about ISNULL

نصائح أخرى

SELECT ISNULL(NULLCOLUMN1, 0) NULLCOLUMN1
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top