kid_drew
kid_drew

Reputation: 4005

ANSI SQL - wildcard alias?

If I have a table like this:

a: string
b: string
c: string

I'd like to be able to perform transformations on certain columns but also pass each column through verbatim. So like this:

a_transform, b_transform, c_transform, a_raw, b_raw, c_raw

Is it possible to do that with a wildcard, something like this:

select
fn(a) as a_transform,
fn(b) as b_transform,
fn(c) as c_transform,
* as *_raw

or do I have to enumerate each column individually?

Upvotes: 0

Views: 140

Answers (1)

Δ O
Δ O

Reputation: 3710

Just use the wildcard retrieving the columns with their original names.

SELECT
fn(a) AS a_transform,
fn(b) AS b_transform,
fn(c) AS c_transform,
*

will result in:

a_transform, b_transform, c_transform, a, b, c

Upvotes: 1

Related Questions