google-sheetsgoogle-sheets-formulagoogle-sheets-querygoogle-query-language

Why my Google Sheet QUERY getting error when selecting date?


I want to query data between two dates. Here is my query:

=query(Profile;"select * where B >= date '"&TEXT(DATEVALUE("27/02/2018"),"yyyy-mm-dd")&"' and B <= date '"&TEXT(DATEVALUE("01/03/2018"),"yyyy-mm-dd")&"";1)

enter image description here

and here is the spreadsheet https://docs.google.com/spreadsheets/d/1AvyMhjPMDeX6lszrrF4dqXssZSzYPuZdcbsQ66jzQOg/edit?usp=sharing


Solution

  • this is the correct syntax:

    =QUERY(Profile; 
     "where B >= date '"&TEXT(C3; "yyyy-mm-dd")&"' 
        and B <= date '"&TEXT(C4; "yyyy-mm-dd")&"'"; 1)
    

    0