How to select UNIX date = “2010” in mysql query?


Problem :

Here is my code so far:

SELECT `date`, title, category, url
FROM cute_news
WHERE category = '4'
ORDER BY `date` DESC

I want make pages based on the year, like, 2010 , 2009, 2008 and so on. The database saves the date as UNIX_Timestamp. Not sure how to query a recordset with a Year parameter?

WHERE unix_timestamp(YEAR) = '2010' or something???

Thanks in advance. I'm baffled.



Solution :

You'll want something like WHERE YEAR(FROM_UNIXTIME(date_field)) = 2010.


Mysql Tutorials

Mysql Howto..

How to update JTable data with MySQL database properly?

How do I express a “has many through” relationship in Entity Framework 5?

How do i display content from a MySQL DB in PHP

How to search for a string with a plus (+) sign using HTML form with MySQL database? [closed]

How to run two queries?(Joomla, mysql)

How to use a checkbox in Django to enter 1 or 0 into MySQL?

How to get response from MySQL database using PHP

How to print Table of this format [closed]

how do I give out incrementing keys to client side from php and mysql ?

How to check if specific datetime was not used using multiple tables?

How to make newsfeed using relational tables in MySQL and PHP

How can I query a MySQL database from a Rails app without models?

How to restore a mysql database in php

PHP: How to list files of a folder in a dropdown and then select one of them accoding to mysql entry

How to use Rand function combined with Union in MySQL

How to map strings/poor JSON to C# object members? (and ultimately to a MySQL database)

How to store a list of data (like an array) in mysql cell? (but have it still be searchable)

How to Write MySQL Select Statement to Show Latest Entry by Each UserID?

How to update unix-timestamp in mysql database

How to insert time 2009-09-22 18:09:37.881 in MYSQL My column type is DateTime

mysql how to get the type of data in a varchar field using query. as it can hold any datatype as string

How to install mysql package for Visual Studio 2013 python tool

How do you handle descriptive database table names and their effect on foreign key names?

How to handle MySQL shutdown in Matlab?

How to create E-R diagram in mysql

SSL to log in, regular http after that… how vulnerable is the data transferred from the database?

Calculate difference between two dates in mysql to show years and months

How to delete certain rows from MySQL table?

MySQL joins: how to simplyfy the given query?

Spring3, Hibernate, MySQL - How do I add transactions control?