Re: [Q] Frusturating SQL question
Posted in 1996
Alex Fiore (alex@informix.com) wrote:
: Saqib Mausoof wrote:
: >
: > Unfortunately, I can't get my SIMPLE query to work. My date
: > column is LASTMOD (DATETIME YEAR TO MINUTE) and I need to get
: > data for just one day. My query is
: >
: > Select lname, fname, vendor, status, lastmod
: > from visitors
: > where lastmod = TODAY (YEAR TO MINUTE)
: > order by 3,2,1
: If I read your query correctly, you will only see listed
: visitors who arrived exactly at midnight since it uses
: the where clause lastmod = TODAY(YEAR TO MINUTE). TODAY
: just returns today's date without any time component(really
: it is just set to 00:00). You really just want to compare
: the date component of lastmod with TODAY.
Not quite, since that will only find rows where lastmod's HTM component
is 00:00. Try:
Select lname, fname, vendor, status, lastmod
from visitors
where DATE(lastmod) = TODAY
order by 3,2,1
--
=======================================================================
Dennis J. Pimple dennisp@informix.com Opinions expressed
Principal Consultant -------------------- are mine, and do not
Informix Software Inc Voice: 303-850-0210 necessarily reflect
Denver Colorado USA Fax: 303-779-4025 those of my employer.