php - MS SQL Select MAX Date Issue -
i know similar lot of posts attempting writing php query connects microsoft sql server. can bring of relevant info want when set clause in php query doesn't run. have 3 tables
| metalsource | metalprice | currency |
in metal prices table there date/time field want find latest date date set database regardless of time, how can done? query follows:
$query = "select mp.metalsourceid, mp.unitprice, mp.datecreated, mp.highunitprice, mp.previousunitprice, mp.previoushighunitprice, mp.metalsourcename, cu.currency tblmetalprice mp inner bring together tblmetalsource ms on mp.metalsourceid = ms.metalsourceid inner bring together tblcurrency cu on ms.currencyid = cu.currencyid select max (datecreated) mp"
like i've said select statement works fine, when trying cut down results clause seems die.
i've looked @ other posts , tried several different things nil seems getting need.
thanks
as per comments:
order datecreated desc limit 31
this order info , limit 31 rows.
php
No comments:
Post a Comment