Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

how to select datas according to year

Codes here !

Moderators: macek, egami, gesf

how to select datas according to year

Postby jumpsalty » Sun Feb 23, 2003 7:32 pm

i have a table like this:

| id | dateinsert |
| 01 | 2002-03-02 |
| 02 | 2002-04-02 |
| 03 | 2003-06-05 |

the column dateinsert is in 'date' format.
how do i select from the table all the data that have dateinsert in the year 2002?
jumpsalty
New php-forum User
New php-forum User
 
Posts: 3
Joined: Wed Nov 20, 2002 11:31 pm

Postby Romantik » Mon Feb 24, 2003 4:27 am

SELECT * FROM YourTable WHERE dateinsert>= '2002-01-01' AND dateinsert<= '2002-12-31'
Romantik
New php-forum User
New php-forum User
 
Posts: 67
Joined: Mon Feb 24, 2003 2:55 am
Location: ../Ukraine/Kherson


Return to mySQL & php coding

Who is online

Users browsing this forum: docharley01 and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron