[英]How to return difference in string values from the same column by doing a grouped string comparison in bigquery sql?
[英]The string from the Breakfas column is in the Lunch column
我需要在結果字段中輸入以下值:真/假,這取決於“午餐”列中是否有可以在“早餐”列中找到的關鍵字。 預期結果是:
WITH Recipes AS
(SELECT 'Blueberry pancakes' as Breakfast, 'Egg salad sandwich' as Lunch UNION ALL
SELECT 'Potato pancakes', 'Toasted cheese sandwich' UNION ALL
SELECT 'Ham scramble', 'Steak avocado salad' UNION ALL
SELECT 'Tomato pasta', 'Tomato soup' UNION ALL
SELECT 'Corned beef hash', 'Lentil potato soup')
SELECT *,
***Field for your code*** result,
FROM Recipes;
不幸的是 function: contains_substr (Breakfast, 'Tomato Pasta') 只考慮一個給定的字符串,而不是整個“午餐”列中的所有字符串。
有誰知道如何解決這個問題?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.