Bruno Magalhães
Bruno Magalhães

Reputation: 13

Select Today's date using BigQuery

I'm using Google Cloud SDK (command-line) via C# and I want to select the information for the Current Date(today).

The select is working but I'm not able to bring the latest date on the column DATE Below is the query I'm using:

        var table = client.GetTable("projectId", "datasetId", "table");

        var sql = $"" +
            $"SELECT " +
            $"sku, " +
            $"FROM {table} " +
            $"WHERE DATE=CurrentDate('America/Sao_Paulo') " +
            $"LIMIT 10";

Schema: SKU - String DATE - Timestamp

Upvotes: 0

Views: 2677

Answers (1)

y0j0
y0j0

Reputation: 3592

Try to use CURRENT_DATE instead of CurrentDate

var table = client.GetTable("projectId", "datasetId", "table");

var sql = $"" +
    $"SELECT " +
    $"sku, " +
    $"FROM {table} " +
    $"WHERE DATE=CURRENT_DATE('America/Sao_Paulo') " +
    $"LIMIT 10";    
       

Upvotes: 2

Related Questions