3

In BigQuery I can write:

SELECT * EXCEPT (col1, col2, ...) ...

Is there an equivalent for RedShift? I don't think there is, but I wanted to see if anyone had any bright ideas.

Incidentally, I find this to be very useful in BigQuery when writing multiple subqueries, each flowing into the next. I can include/exclude columns at the relevant part of the query without having it break something later on, which is very useful when developing a complex query.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
goose
  • 2,502
  • 6
  • 42
  • 69

2 Answers2

1

Not to my knowledge.

The only EXCEPT is the normal SELECT functionality to subtract one relation from another.

  • Thanks Max - pls also see John Rotenstein's comment on the question, he's confirmed this to be the case. – goose Sep 01 '21 at 08:30
1

This answer on a related question might work in Redshift too: https://stackoverflow.com/a/1712243/12170 (copy the date to a temporary table, alter that copy by dropping the columns you don't want from it, then use that as input)

PatrickvL
  • 4,104
  • 2
  • 29
  • 45