简体   繁体   中英

BIGQUERY: Select and replace

I'm very new to bigquery and I am looking to run a query which selects every row from a table where touch_by_bot is false. I then want to replace these same row values with true.

I figured out how to pull the rows that are false but I can't figure out how to replace the false values with true:

'SELECT * FROM ... WHERE touched_by_bot = false'

select * replace(true as touched_by_bot) from ... where touched_by_bot = false

or updating the table itself.

create temp table your_table as 
select false as touched_by_bot union all
select true;

update your_table set touched_by_bot = true where touched_by_bot = false;

select * from your_table;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM