[英]All, any and some function in BIG QUERY
各位晚上好!
我需要在大查詢中使用以下表達式:
select
*
from employee
where age > all (
select
age
from employee
where gender = 'M')
但出於某種原因,我無法使用此結構,並出現以下錯誤“語法錯誤:[5:13] 處的意外關鍵字 ALL”。
我可以在 sqlserver 中使用它,但我怎樣才能讓它在 BQ 中工作? 謝謝!
您可能會考慮在 BigQuery 中使用以下查詢。
SELECT *
FROM employee
WHERE age > (SELECT MAX(age) FROM employee WHERE gender = 'M');
還請考慮以下方法
SELECT *
FROM employee
QUALIFY age > MAX(IF(gender = 'M', age, NULL)) OVER()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.