From: "T. H. Grejc"
Hello,
I'm trying to select all distinct years from a unixtimestamp field in MySQL database (3.23.56). I have a query:
SELECT DISTINCT YEAR(date_field) As theYear FROM table
but PHP gives me an empty array. What am I doing wrong?
TNX
I think you need this function
FROM_UNIXTIME(unix_timestamp,format).
Year does not operate on a unix timestamp.
Working like a charm. My query now is:
SELECT DISTINCT FROM_UNIXTIME(created, '%Y %M') FROM table_name ORDER BY created DESC
How can I add more fields to query. If I write:
SELECT DISTINCT FROM_UNIXTIME(created, '%Y %M'), other_field FROM table_name ORDER BY created DESC
I loose distinction (all dates are displayed).
TNX
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]