Jenny
Jenny

Reputation: 1

How to search GDELT data filtering country actors in big query?

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!

Upvotes: 0

Views: 453

Answers (1)

Timogavk
Timogavk

Reputation: 869

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')

Upvotes: 0

Related Questions