Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ilike expression support in bigquery

BigQuery throws an error when 'ilike' expression is used. What is the alternative for doing case insensitive like query?

Below is the relevant part of the query.

SELECT id FROM `performance_last30days` WHERE device ilike 'DESKTOP'
Syntax error: Expected ")" but got "ilike" 
like image 505
vaichidrewar Avatar asked Dec 18 '22 13:12

vaichidrewar


1 Answers

SELECT id 
FROM `performance_last30days` 
WHERE UPPER(device) LIKE '%DESKTOP%'

or

SELECT id 
FROM `performance_last30days` 
WHERE REGEXP_CONTAINS(device, r'(?i)DESKTOP')
like image 80
Mikhail Berlyant Avatar answered Dec 28 '22 05:12

Mikhail Berlyant