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
 SQL query with date

Author  Topic 

lucassoberano
Starting Member

1 Post

Posted - 2010-10-20 : 01:01:37
Hi!

I need the following thing:

I must to a QUERY with SQL SERVER where I select a column that has a DATE. If the week day of that DATE is SUNDAY then I should show FRIDAY. And if it´s SATURDAY is should show it as TUESDAY.

Which would be the QUERY?
Thanks!!
Lucas

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-10-20 : 01:55:31
Look up DATEPART and DATEDIFF. It should be relatively easy to use CASE on the datepart and then use datediff appropriately.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-10-20 : 12:46:15
what kind of a rule is this? what if day value is anything else? better to add a mapping table if it varies for each day

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -