Re: Temporary table and virtual column
Posted in 1998
Ian Clark wrote:
>
> Hi All,
>
> Take a look at the following statements written into a 4GL program:
>
> SELECT field1, field2, "TR" FROM table1 WHERE some_conditions1
> UNION
> SELECT field1, field2, "SH" FROM table1 WHERE some_conditions2
> INTO TEMP temp_table>
> This doesn't go down to well with the compiler since the virtual
> column of static values I want to insert cannot be achieved unless I
> somehow have a column name too.
> Replacing the above with this;
You ALMOST got it! Try:
SELECT field1, field2, "TR" field_alias FROM table1 WHEREsome_conditions1
UNION
SELECT field1, field2, "SH" field_alias FROM table1 WHEREsome_conditions2
INTO TEMP temp_table;
This will create a temp table, named temp_table, with the columns named
field1, field2, field_alias
Art S. Kagel