Re: SELECTing NULL in view w/ union
Posted in 1999
Allen How about: SELECT <col1>,<col2>,to_char(col3) from A UNION SELECT <col1>,<col2>,"" from B UNION SELECT <col1>,<col2>,"" from C ; HTH Sujit allenj <allenj@ndr.com> on 08/26/99 11:46:50 AM Please respond to allenj <allenj@ndr.com> To: informix-list@iiug.org cc: (bcc: Sujit Pal) Subject: SELECTing NULL in view w/ union I am taking advantage of the new 7.31 ability to create a view containing a union. I have three tables A,B and C that I want to UNION together into a view. ala: SELECT <col1>,<col2>,<col3> from A UNION SELECT <col1>,<col2>,<col3> from B UNION SELECT <col1>,<col2>,<col3> from C ; The tables are the same EXCEPT that table A has an extra date column that tables B and C don't have. I do want that Table A date column in the view. The column should be NULL for rows from tables B and C in the view. When I UNION together the SELECTs, the number of columns must be the same all the way across. What do I specify for this extraneous date column (that I want to be NULL) in the SELECTs for tables B and C??? I tried a SELECT <col1>,<col2>,NULL,<col3> from B.......... but the engine yells about there not being a column named NULL. If I can help it, I don't want to resort to "" in the SELECT stmt. Any ideas? thanks allen