Search code examples
sqlgoogle-visualizationgoogle-query-language

Google Query Language: filter by date


I'm trying to add a filter by date in a Google Visualization API query, but I'm doing something wrong with the syntax...

This is the code without the date filter:

query.setQuery('SELECT A, B, C, D, E, F, G where upper(A) like upper("keyword") or upper(F) like upper("keyword") order by B DESC');

I want to add an AND and also add the condition that date in ColB must be >= of 1st Aug 2016.

So I tried with:

query.setQuery('SELECT A, B, C, D, E, F, G where upper(A) like upper("keyword") or upper(F) like upper("keyword") AND upper(B) >= date "2016-08-01" order by B DESC');

But the syntax is probably wrong as the query gets interrupted.


Solution

  • If B is a date your error is:

    Unable to parse query string for Function QUERY parameter 2: upper takes a text parameter

    To solve it just remove upper function.

    IF B is just a string then automatic type casting is done and query should run without problems.

    enter image description here