March 24, 2003 at 10:53 am
Once again, I think I may be close to my solution.
When I ran what dan gave me everything worked ok, but I still had too many dates from my calendar table. So I figured if can create a table that has less dates I may have what I need. So here's what I came up with
declare @t table(weekend smalldatetime not null)
insert into @t (weekend)
select weekend from calendar
where weekend BETWEEN '2003-01-10 00:00:00' AND '2003-02-07 00:00:00'
SELECT (dbo.Reps.[Last] + ', ' + dbo.Reps.[First]) as repname, dbo.RepWeeklyApp.Made1st, dbo.RepWeeklyApp.Kept1st, dbo.RepWeeklyApp.PGs, dbo.RepWeeklyApp.MS,
dbo.RepWeeklyApp.Made2nd, dbo.RepWeeklyApp.Kept2nd, dbo.RepWeeklyApp.Closed2nd, dbo.RepWeeklyApp.LastEditDate,
dbo.RepWeeklyApp.RegManager
FROM @t LEFT OUTER JOIN
dbo.RepWeeklyApp ON @t.weekend = dbo.RepWeeklyApp.WeekEnd
AND(bo.RepWeeklyApp.RepID = 'CB909B54-7C0F-4908-B059-52B4027326AC')
My problem here is the query analyser says that I haven't declared @t??
March 24, 2003 at 11:27 am
At long last I have finally found my solution!
Thanx to all that helped out. I really learned a lot! A special thanx to Dan who's little tip helped in a big way. While it's not EXACTLY what I was looking for I can use the results in crystal to get what i'm looking for.
Check the code
SELECT dbo.calendar.weekend, dbo.RepWeeklyApp.RepID
FROM dbo.calendar LEFT OUTER JOIN
dbo.RepWeeklyApp ON dbo.calendar.weekend = dbo.RepWeeklyApp.WeekEnd
and (dbo.RepWeeklyApp.RepID = 'CB909B54-7C0F-4908-B059-52B4027326AC'OR dbo.RepWeeklyApp.RepID IS NULL)
where (dbo.calendar.weekend BETWEEN CONVERT(DATETIME,
'2003-01-10 00:00:00', 102) AND CONVERT(DATETIME, '2003-02-07 00:00:00', 102))
Thanx again!
Viewing 2 posts - 16 through 16 (of 16 total)
You must be logged in to reply to this topic. Login to reply