tags:

views:

46

answers:

2

My DB has a list of song I like that I have places on my web site for my friends to listen to.

Some days I will upload 5 songs. Some days 1. Some days 0.

What I want to do is select all the songs from say the last two weeks or last month but not have it limited by the number of songs or days I might have skipped uploading a song.

For example if I wanted to get the last week and the songs in my DB looked something like this:

Sat - Song Sat - Song Sat - Song

Friday - Song

Wednesday - Song Wednesday - Song

Tuesday - Song

What is the best way to query this data?

+2  A: 

You could use DATE_SUB:

SELECT field1, field2 FROM songtable WHERE songuploaddate >= DATE_SUB( NOW( ) , INTERVAL 2 WEEK )
Tom Haigh
A: 

Do you own the copyright for these songs which you are making publicly available on the internet?

If not watch out you might get a nasty letter from the RIAA asking you for $$$$$ and threatening you with a lawsuit.

Omar Kooheji
Wow. Thanks mommy!
ian
Any time. :P Son
Omar Kooheji