'Using Google Sheets query function and it is not returning the correct rows

I am using the google sheets query function to dynamically pull data from another sheet into an easier to read sheet. This is me attempting to make google sheets into a functional database. An example table of the data is shown below.

Example Table of the Raw Data

The query I am writing is

=QUERY(Raw_Data!A1:E10000, "select B where D = '"&D3&"' and C = '"&D2&"'",0)

which returns no results when D3 is equal to "Saturday, February 5" and
D2 is equal to "Wairakei 2".

However, when replacing the "and" with an "or" and leaving the cells the same

=QUERY(Raw_Data!A1:E10000, "select B where D = '"&D3&"' and C = '"&D2&"'",0)

this returns

152646563 153237668 145802639

It seems like this should be the result I get with the "and" operator and is wrong for the "or" operator. Any help on this issue would be gladly appreciated. Thanks in advance for your help.



Solution 1:[1]

If D3 is a date, use

D = DATE'"&TEXT(D3,"yyyy-MM-dd")&"'

instead of D = '"&D3&"'

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mike Steelson