When I used modulo operator (%) in WHERE clause on BigQuery,
SELECT * from `our-project.data_set1.table1` WHERE the_id % 10 = 0 LIMIT 1000
it was rejected with the error message like as;
Error: Syntax error; Illegal input character "%" at [1:50]
I made the turn-around like,
SELECT * from `our-project.data_set1.table1`
WHERE CAST((the_id / 10) AS INT64) * 10 = the_id LIMIT 1000
However, it seems to be wasteful.
How can I use modulo operation in BigQuery's WHERE clause?
(In this example, I wrote in Standard SQL Dialect)
Try mod(id, 10) = 0
instead in the where clause
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With