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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Date range from another table

Author  Topic 

Biltongboere
Starting Member

3 Posts

Posted - 2005-06-23 : 03:22:13
Hi

I have 2 tables Range and Sales.

In my Range Table is a startdate and enddate.
my sales have a salesDate

I would like to be able to retrieve my sales where the sales date is NOT in the range table( between any startdate enddate of the record).

is there anyway of doing this in sql?

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-06-23 : 03:35:57
Post table structures

Madhivanan

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

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-06-23 : 04:41:50
set crystal_ball on

declare @startdate smalldatetime,@enddate smalldatetime

select @startdate=startdate, @enddate=enddate from myRange

select field1,field2 from mysales
where salesdate not between @startdate and @enddate

set crystal_ball off
go

--------------------
keeping it simple...
Go to Top of Page

Biltongboere
Starting Member

3 Posts

Posted - 2005-06-23 : 05:38:10
Thank You it works Perfectly
Go to Top of Page

coolerbob
Aged Yak Warrior

841 Posts

Posted - 2005-06-23 : 06:47:21
Mooi so groot seun. Kom terug enige tyd
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-06-23 : 06:53:28
quote:
Originally posted by coolerbob

Mooi so groot seun. Kom terug enige tyd


Which language is it?
And what does it mean?

Madhivanan

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

Biltongboere
Starting Member

3 Posts

Posted - 2005-06-23 : 08:27:22
quote:
Originally posted by madhivanan

quote:
Originally posted by coolerbob

Mooi so groot seun. Kom terug enige tyd


Which language is it?
And what does it mean?

Madhivanan

Failing to plan is Planning to fail



It is afrikaans a language spoken in South Africa and Namibia (+/- 97 % of Namibians can speak it) It roughly translated means "come back any time"
Go to Top of Page
   

- Advertisement -