Re: [Q] Frusturating SQL question
Posted in 1996
Alex Fiore — — source: Informix-list mailing list archive (1991-1998)
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.