Reputation: 955
Working in Netezza and trying to run the following query:
CREATE TEMP TABLE COUNTS
AS SELECT COUNT(*) AS ROWCOUNT, 'CA' AS PLAN FROM TABLE1;
INSERT INTO COUNTS
(SELECT COUNT(*) FROM TABLE2, 'FL');
SELECT * FROM COUNTS;
But for some reason, it doesn't like the 'FL' part and if I remove it:
INSERT INTO COUNTS
(SELECT COUNT(*) FROM TABLE2);
it runs fine but with a NULL where I wanted FL to be.
I don't know what's going on. Any help is greatly appreciated. Thank you very much in advance!
Upvotes: 2
Views: 838
Reputation: 133360
could be you must declare the column explicitally
INSERT INTO COUNTS(ROWCOUNT, PLAN)
SELECT COUNT(*), 'FL' FROM TABLE2';
Upvotes: 2