Skip to content
Advertisement

Ambiguous Source ID

I’m not sure what I’m doing wrong here. I tried to make an alias because it exits as an item in both tables I’m trying to join, but I keep getting an ambiguous error for sourceId.

SELECT isAccepted, sourceId,
FROM `nyt-bigquery-beta-workspace.comments_data.comments_backend` as cb
  LEFT JOIN dig_pubp.content_master_filtered as cm
  ON(REPLACE(cb.articleId, 'article_', '') = cb.sourceId)

Advertisement

Answer

try this

SELECT cb.isAccepted, cb.sourceId,
FROM `nyt-bigquery-beta-workspace.comments_data.comments_backend` cb
  LEFT JOIN dig_pubp.content_master_filtered cm
  ON(REPLACE(cb.articleId, 'article_', '') = cb.sourceId)

change the alias for select depending on which table it is in

Also are you purposely joining on columns from the same table? Or should one of those identifiers be ‘cm’

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement