문제

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

도움이 되었습니까?

해결책

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  
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top