On Sep 20, 2007, at 3:17 PM, Kenneth Kixmoeller/fh wrote:

> In Fox syntax, examples of I am trying to do are:
>
> 1:
> SELECT (fields)
>   FROM (table)
>     WHERE YEAR(<datetimefield>) = YEAR(DATE())
>
> IOW, where the dates in<datetimefield> are *this* year.

        It's almost identical in MySQL:

WHERE YEAR(<field>) = YEAR(NOW())


> 2:
> SELECT (fields)
>   FROM (table)
>     WHERE <datetimefield> >= gomonth(DATETIME(),-6)
>
> IOW, where the dates in <datetimefield> are more recent than 6 months
> ago.

SELECT DATE_SUB(NOW(), INTERVAL 6 MONTH)

... will give you the date 6 months ago. DATE_ADD will give you 6  
months in the future.

        Date/time functions are documented at http://dev.mysql.com/doc/ 
refman/5.1/en/date-and-time-functions.html ( -or- http://tinyurl.com/ 
fl5wn )

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to