task: metadata: install: pip install -e .
patch: diff --git a/pypinfo/core.py b/pypinfo/core.py
index fe4de37..39fb272 100644
--- a/pypinfo/core.py
+++ b/pypinfo/core.py
@@ -138,20 +138,16 @@ def build_query(
     for field in fields:
         query += f'  {field.data} as {field.name},\n'
 
-    query += FROM
-
-    query += f'\nWHERE timestamp BETWEEN {start_date} AND {end_date}\n'
+    query += f'{FROM}\n'
+
+    conditions = [f'WHERE timestamp BETWEEN {start_date} AND {end_date}\n']
+    if project:
+        conditions.append(f'file.project = "{project}"\n')
+    if pip:
+        conditions.append('details.installer.name = "pip"\n')
+    query += '  AND '.join(conditions)
     if where:
         query += f'  AND {where}\n'
-    else:
-        conditions = []
-        if project:
-            conditions.append(f'file.project = "{project}"\n')
-        if pip:
-            conditions.append('details.installer.name = "pip"\n')
-        if conditions:
-            query += '  AND '
-            query += '  AND '.join(conditions)
 
     if len(fields) > 1:
         gb = 'GROUP BY\n'

problem_statement: --where ignores project
These match because `--where 'file.project = "project"'` gets silently overridden:
```console
$ pypinfo --days 1095 --limit 36 --order download_month --where 'details.python = "1.17"' '' month
Served from cache: False
Data processed: 186.48 GiB
Data billed: 186.48 GiB
Estimated cost: $0.92

| download_month | download_count |
| -------------- | -------------- |
| 2018-03        |         18,667 |
| 2018-02        |         67,154 |
| 2018-01        |      1,898,377 |
| 2017-12        |         70,865 |
| 2017-11        |         64,577 |
| 2017-10        |         66,968 |
| 2017-09        |         63,809 |
| 2017-08        |         93,022 |
| 2017-07        |        628,639 |
| 2017-06        |        200,335 |
| 2017-05        |        148,618 |
| 2017-04        |         50,842 |
| 2017-03        |         53,755 |
| 2017-02        |         47,414 |
| 2017-01        |         50,651 |
| 2016-12        |         53,138 |
| 2016-11        |        129,537 |
| 2016-10        |        477,819 |
| 2016-09        |      1,013,797 |
| 2016-08        |        116,291 |
| 2016-07        |         81,521 |
| 2016-06        |         59,695 |
| 2016-05        |        151,872 |
| 2016-03        |          4,618 |
| 2016-02        |        226,267 |
| 2016-01        |        184,133 |
```
```console
$ pypinfo --days 1095 --limit 36 --order download_month --where 'details.python = "1.17"' certifi month
Served from cache: True
Data processed: 0.00 B
Data billed: 0.00 B
Estimated cost: $0.00

| download_month | download_count |
| -------------- | -------------- |
| 2018-03        |         18,667 |
| 2018-02        |         67,154 |
| 2018-01        |      1,898,377 |
| 2017-12        |         70,865 |
| 2017-11        |         64,577 |
| 2017-10        |         66,968 |
| 2017-09        |         63,809 |
| 2017-08        |         93,022 |
| 2017-07        |        628,639 |
| 2017-06        |        200,335 |
| 2017-05        |        148,618 |
| 2017-04        |         50,842 |
| 2017-03        |         53,755 |
| 2017-02        |         47,414 |
| 2017-01        |         50,651 |
| 2016-12        |         53,138 |
| 2016-11        |        129,537 |
| 2016-10        |        477,819 |
| 2016-09        |      1,013,797 |
| 2016-08        |        116,291 |
| 2016-07        |         81,521 |
| 2016-06        |         59,695 |
| 2016-05        |        151,872 |
| 2016-03        |          4,618 |
| 2016-02        |        226,267 |
| 2016-01        |        184,133 |
```
This isn't a huge deal other than there isn't really a reason to even accept `project` in these cases.

Maybe it'd be better to tell people to run `--where 'file.project = "project"'` themselves or to work in an `AND` on custom `--where`s:
```console
$ pypinfo --days 1095 --limit 36 --order download_month --where 'details.python = "1.17" AND file.project = "certifi"' '' month
Served from cache: False
Data processed: 331.50 GiB
Data billed: 331.50 GiB
Estimated cost: $1.62

| download_month | download_count |
| -------------- | -------------- |
| 2018-03        |             70 |
| 2018-02        |             68 |
| 2018-01        |            155 |
| 2017-12        |             93 |
| 2017-11        |            116 |
| 2017-10        |             90 |
| 2017-09        |             95 |
| 2017-08        |             86 |
| 2017-07        |            112 |
| 2017-06        |             83 |
| 2017-05        |             69 |
| 2017-04        |             29 |
| 2017-03        |             12 |
| 2017-02        |             10 |
| 2017-01        |             13 |
| 2016-12        |              8 |
| 2016-11        |              8 |
| 2016-10        |             15 |
| 2016-09        |             55 |
| 2016-08        |             19 |
| 2016-07        |              3 |
| 2016-06        |             14 |
| 2016-05        |              3 |
| 2016-03        |              4 |
| 2016-02        |             13 |
| 2016-01        |              7 |
```

`--order` is affected by the same issue.
repo: ofek/pypinfo
test_cmd: pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
test_patch: diff --git a/tests/test_core.py b/tests/test_core.py
index 3178977..1b031f4 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -3,7 +3,7 @@ import copy
 import pytest
 
 from pypinfo import core
-from pypinfo.fields import PythonVersion
+from pypinfo.fields import File, PythonVersion
 
 ROWS = [
     ['python_version', 'percent', 'download_count'],
@@ -196,6 +196,69 @@ LIMIT 100
     assert output == expected
 
 
+def test_build_query_where():
+    # Arrange
+    # pypinfo -sd -2 -ed -1 --test --where 'file.filename LIKE "%manylinux%"' numpy file
+    project = "numpy"
+    all_fields = [File]
+    start_date = "-2"
+    end_date = "-1"
+    days = None
+    limit = 10
+    where = 'file.filename LIKE "%manylinux%"'
+    order = None
+    pip = True
+    expected = r"""
+SELECT
+  file.filename as file,
+  COUNT(*) as download_count,
+FROM `bigquery-public-data.pypi.file_downloads`
+WHERE timestamp BETWEEN TIMESTAMP_ADD(CURRENT_TIMESTAMP(), INTERVAL -2 DAY) AND TIMESTAMP_ADD(CURRENT_TIMESTAMP(), INTERVAL -1 DAY)
+  AND file.project = "numpy"
+  AND details.installer.name = "pip"
+  AND file.filename LIKE "%manylinux%"
+GROUP BY
+  file
+ORDER BY
+  download_count DESC
+LIMIT 10
+    """.strip()  # noqa: E501
+
+    # Act
+    output = core.build_query(project, all_fields, start_date, end_date, days, limit, where, order, pip)
+
+    # Assert
+    assert output == expected
+
+
+def test_build_query_no_project():
+    # pypinfo -sd -2 -ed -1 -l 20 --all --test ''
+    project = ""
+    all_fields = []
+    start_date = "-2"
+    end_date = "-1"
+    days = None
+    limit = 20
+    where = None
+    order = None
+    pip = False
+    expected = r"""
+SELECT
+  COUNT(*) as download_count,
+FROM `bigquery-public-data.pypi.file_downloads`
+WHERE timestamp BETWEEN TIMESTAMP_ADD(CURRENT_TIMESTAMP(), INTERVAL -2 DAY) AND TIMESTAMP_ADD(CURRENT_TIMESTAMP(), INTERVAL -1 DAY)
+ORDER BY
+  download_count DESC
+LIMIT 20
+        """.strip()  # noqa: E501
+
+    # Act
+    output = core.build_query(project, all_fields, start_date, end_date, days, limit, where, order, pip)
+
+    # Assert
+    assert output == expected
+
+
 def test_build_query_bad_end_date():
     # Arrange
     project = "pycodestyle"