Home > Software design >  How to display date time field as blank or 1900-01-01 if the date time value is null using sql comma
How to display date time field as blank or 1900-01-01 if the date time value is null using sql comma

Time:06-27

I am using Mem SQL and have to display date time field as '1099-01-01' or blank if the date-time field is null

CodePudding user response:

To display date as blank when there is no data for it in the column from your table, use:

select COALESCE(' ', your_date_field::text) as date_column from your_table;

To display the date as a default one like 1900-01-01, then use the following:

select COALESCE('1900-01-01', your_date_field::text) as date_column from your_table;

CodePudding user response:

To display empty

select COALESCE(DateColumn,'')  from TableName;

To Display Static Value

select COALESCE(DateColumn,'1900-01-01')  from TableName;
  • Related