Reputation: 427
I have tables with following names:
PID_01
PID_02
PID_03
...
PID_LIST_01
PID_LIST_02
PID_LIST_03
...
Need to perform the following query
SELECT
Column01,
Column02,
Column03
FROM
`dataset.PID_*`
only on
PID_01
PID_02
PID_03
...
How to filter out the unneeded tables?
Upvotes: 0
Views: 110
Reputation: 172974
If PID_
and PID_LIST_
tables have the same schema or at least both have those three columns, below should work
SELECT
Column01,
Column02,
Column03
FROM
`dataset.PID_*`
WHERE NOT _TABLE_SUFFIX LIKE 'LIST_%'
there can be variations of above WHERE clause - but I hope you got an idea
Upvotes: 2