Q:

Between .. and clause in sql server?

in my web application i am displaying videos of user, I want to display the videos which are between 30 days only. Videos that are uploaded last 30 days only.
i write query like this but it is not working fine..
  select * 
    from videos 
   where posteddate between getdate()-30 and getdate()  
order by posteddate desc

can u help me 

A:

Use the DATEADD function:
WHERE posteddate BETWEEN DATEADD(dd, -30, GETDATE())
                     AND GETDATE()

You are aware that GETDATE() includes the time portion?

