Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Get birthdays in upcoming 10 days

Author  Topic 

logicboard
Starting Member

2 Posts

Posted - 2011-02-08 : 07:37:23
Hello

I'm required to write queries where I have to manipulate dates, how can I select all entries where the date will come in the next 10 days (regardless of the year) ?

Or is there a way to get a timestamp from a formatted date ?

Thanks a lot!

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2011-02-08 : 07:42:32
Just a guess
Where ColumnName between getdate() and dateadd (d,10,getdate())

However it would be better if you can come up with an example , data and required output

Cheers
MIK

Go to Top of Page

logicboard
Starting Member

2 Posts

Posted - 2011-02-08 : 07:49:31
The query would look something like that:
SELECT customer_id, customer_name, birthdate FROM tbl_customers WHERE birthdate "Is in the next 10 days"...

I'm working with MySQL and EasyPHP.
Go to Top of Page

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2011-02-08 : 08:00:06
quote:
Originally posted by logicboard

The query would look something like that:
SELECT customer_id, customer_name, birthdate FROM tbl_customers WHERE birthdate "Is in the next 10 days"...

I'm working with MySQL and EasyPHP.




in MySQL case i dont know about the replacement of Getdate() and DateAdd. So have given you the idea how can you do it now its up to you how to incorporate in your MySQL code

Also this (SQLTeam Dot Com) is related to SQL server only*. Therefore if you have questions related to SQL server then you're most welcome, even else you are Welcome Too but for generic sort of questions related to DBMS theory etc ..
Go to Top of Page
   

- Advertisement -