1

I am trying to pull the value from the 'dwgm_10am_final_price' column with today's current date (2021-01-06). In this case it will be null until a value is inserted into the table at 10am. as depicted in the image below.

Table

This is the current query I am trying but it is returning 'No Data' on my Grafana dashboard. How can I edit my query to always pull the data with today's timestamp, regardless of it is NULL or a numerical value.

SELECT gas_date AS time, dwgm_10am_final_price
FROM gas_market_prices 
WHERE DATE('time') = CURDATE()
nbk
  • 45,398
  • 8
  • 30
  • 47

1 Answers1

0

You are trying to get a date from the String time, which doesn't exist

You need to use backticks for your query

SELECT gas_date AS time, dwgm_10am_final_price
FROM gas_market_prices 
WHERE DATE(`time`) = CURDATE()

You can read this canonical thread When to use single quotes, double quotes, and backticks in MySQL

nbk
  • 45,398
  • 8
  • 30
  • 47