0

I want to search GDELT data using big query since the analysis service on gdelt official website is updating. So the idea is I need to select data with specific country actors (eg. Actor1 is US and Actor2 is China).

I tried something like this:

SELECT 
*
FROM `gdelt-bq.full.events`
WHERE Year >= 2019
AND Actor1CountryCode= 'US' 
AND Actor2CountryCode= 'CN'

but it says no data to display.

I am fresh new to sql so I would appreciate it if anyone could help out!

Jenny
  • 1
  • 1

1 Answers1

0

You have to use IN for one field condition

SELECT 
*
FROM `gdelt-bq.full.events`
WHERE Year >= 2019
AND Actor1CountryCode IN ('US', 'CN')

Because one record can not have to conditions in one cell

Same as

SELECT 
*
FROM `gdelt-bq.full.events`
WHERE Year >= 2019
AND (Actor1CountryCode= 'US' 
OR Actor2CountryCode= 'CN')
Timogavk
  • 809
  • 1
  • 7
  • 20
  • Thanks! but if I want to search data that satisfy both conditions, should I use AND (Actor1CountryCode= 'US' And Actor2CountryCode= 'CN') instead? I tries but it still doesn't work. – Jenny Mar 11 '22 at 05:40
  • sorry. Your query is right. But there are no one record according your condition – Timogavk Mar 11 '22 at 06:01