0

I have database table for currencies. I update currencies on daily basis by using google finance API along with date and time. My column name is Date and data type is datetime

I want to fetch currency rate of Dollar which is last updated on database on basis of date, instead of id of table.

Below queries shows always same result.

SELECT * FROM `currencyrates` WHERE CurrencyCode='USD' AND Rate > 0  ORDER BY 'Date' ASC

SELECT * FROM `currencyrates` WHERE CurrencyCode='USD' AND Rate > 0  ORDER BY 'Date' DESC

enter image description here

It always shows records from 2015, instead it should show record of 2019 first because records exits in database i checked it by sorting in my SQL tool (SQLyog).

enter image description here

Rahat Hameed
  • 412
  • 3
  • 16

1 Answers1

0

*SELECT * FROM currencyrates WHERE CurrencyCode='USD' AND Rate >= 0 ORDER BY 'Date' ASC

SELECT * FROM currencyrates WHERE CurrencyCode='USD' AND Rate >= 0 ORDER BY 'Date' DESC*

pearl
  • 26
  • 2