[英]BigQuery Standard SQL SELECT rows WHERE field contains words from another table field
I have 2 tables in BigQuery.我在 BigQuery 中有 2 个表。 VIDEOS table contains video names and tags. VIDEOS 表包含视频名称和标签。 CREATORS table contains information about video creators. CREATORS 表包含有关视频创作者的信息。 The VIDEOS.tags field contains comma separated quoted strings. VIDEOS.tags 字段包含逗号分隔的带引号的字符串。
I need to select all the videos that were tagged with names in the CREATORS table with results looks like this:我需要在 CREATORS 表中选择所有标有名称的视频,结果如下所示:
Title 1, Creator 1
Title 2, Creator 2
Title 3, Creator 2
Title 4, Creator 3
Title 5, Creator 3
...
But what I have below does not return any results in BigQuery.但是我下面的内容在 BigQuery 中没有返回任何结果。
SELECT
B.name AS Title,
C.creator_name AS Creator
FROM `project.database.VIDEOS` AS B, `project.database.CREATORS` AS C
WHERE B.tags LIKE CONCAT('%"', C.creator_name ,'"%')
在这种情况下,通常是因为情况不同 - 尝试
WHERE LOWER(B.tags) LIKE CONCAT('%"', LOWER(C.creator_name) ,'"%')
I think you want it the other way around: The tag has to look like the name.我想你想要反过来:标签必须看起来像名字。 Let me know让我知道
SELECT
B.name AS Title,
C.creator_name AS Creator
FROM `project.database.VIDEOS` AS B, `project.database.CREATORS` AS C
WHERE C.creator_name LIKE CONCAT('%"', B.tags ,'"%')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.