Hi, i am trying to retrive some datetime set from the database (2 posts in this table), senastposted is a datetime field.
when i run:
SELECT senastposted FROM ftp WHERE senastposted <= 2005-10-28
i get this result:
senastposted
0 record(s) affected.
and when i run:
SELECT senastposted FROM ftp WHERE senastposted >= 2005-10-28
i get this result:
senastposted
25-10-2005
29-10-2005
2 record(s) affected.
what i want is to retrive the first value based on the date:
25-10-2005
any idea why SELECT senastposted FROM ftp WHERE senastposted <= 2005-10-28 dosent work?
( i have tried to change the dates to 28-10-2005 and 28/10-2005)
Hello Pafo,
You might try something similar to this:
<code>
SELECT DATE_FORMAT(datetime,'%d/%m/%Y') AS dt WHERE ...
</code>
|||Please excuse the earlier comment. When i clicked the link the text of the message was a single period.
Most DBMS systems use proprietary extentions for dealing withdates. Stuff like 'before' or 'after'. look up dateoperations in SqlServer.
No comments:
Post a Comment