I have a situation where in I have to combine two tables without losing any data. The two tables have different structures. Following is the structures of my tables
TABLE A
ID_NO INT,
Ship_Date DATE,
Status varchar(10),
total decimal(12,2)
TABLE B
ID_NO INT,
Status varchar(10),
total decimal(12,2)
I tried using UNION ALL by including a dummy column in TABLE B as follows
TABLE B
ID_NO INT,
'',
Status varchar(10),
total decimal(12,2)
but in the result set i get 1900-01-01 as Ship_Date instead of ”. How to eliminate this?
Use a NULL value instead of an empty string. If you don’t mind the Ship_Date result as a string, then you can wrap the UNION in another select statement.