Skip to content
Advertisement

How to use two where conditions in SQL?

Following is the query I have written and I need to where conditions.

  1. Admin_Level_3_palika is not null
  2. Year = ‘2021’

However, the following query is still giving me null values for Admin_Level_3_palika

Please help me with how to work with this. Following is an example of my dataset, Epid_ID being unique for each row.

Advertisement

Answer

If these are your conditions:

Then you need and:

If year is an integer (as I would expect it to be), drop the single quotes. Don’t mix data types in comparisons.

For performance, you might also want to limit the week number:

And finally, BigQuery offers countif() which I recommend:

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