Reputation: 578
I'm trying to make a copy of a table with only distinct values, using the following syntax:
SELECT DISTINCT *
INTO :TAB_DISTINCT
FROM TAB_MAIN
But IB doesn't like the INTO line (builds a plan ok with that line commented) Invalid token. Dynamic SQL Error. SQL error code = -104. Token unknown - line 2, char -1. INTO.
I've tried with & without the colon, also with & without an empty pre-existing TAB_DISTINCT with fields set up. but no cigar.
Anyone have any clues what dumbass syntax error i'm making here? many thanks, Brian
Upvotes: 2
Views: 3788
Reputation: 5481
You can make a copy of a table with following statement:
INSERT INTO copy_table (field1, field2, ... fieldn)
SELECT DISTINCT field1, field2, ... fieldn
FROM source_table
Upvotes: 5