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
 Getting Items for this week by date

Author  Topic 

velnias2010
Posting Yak Master

125 Posts

Posted - 2010-11-22 : 10:07:50
SELECT CONVERT(varchar, f.FixtureDate, 106) AS stringDate, DATENAME(DW, f.FixtureDate) AS DayOfWeek, f.FixtureDate, f.Meeting, f.VenueCode, f.Evening, f.BankHoliday,
f.Type, f.MeetingNum, f.Cancelled, v.Content_ID, f.Festival
FROM tbHRI_Fixtures AS f INNER JOIN
tbHRI_Venue AS v ON f.VenueCode = v.RA_Venue_id
WHERE (DATEDIFF(Day, f.FixtureDate, GETDATE()) < 7)
ORDER BY f.FixtureDate, f.Festival DESC, f.Meeting

Im looking to tweek this line
(DATEDIFF(Day, f.FixtureDate, GETDATE()) < 7)

To get items from today + 7 days I.e all items whose date is range of this week

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-11-24 : 09:29:24
may be this?

WHERE (DATEDIFF(Day, f.FixtureDate, GETDATE()+7) < 7)


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

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-11-26 : 03:10:25

where
f.FixtureDate>=dateadd(day,datediff(day,0,getdate()),0) and f.FixtureDate<dateadd(day,datediff(day,0,getdate())+7,0)


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -