Comparing 2 dates

I have a table like this

CREATE TABLE tbl_CustMaster
(
CustID BIGINT IDENTITY(1,1)
CustName VARCHAR(100),
JoinDate DateTime,
EndDate DateTime
)

Now I want to run a query in which I want to extract custID which lies between JoinDate and EndDate. Can someone help me in doing this??
[322 byte] By [maverick786us] at [2007-11-20 11:11:05]
# 1 Re: Comparing 2 dates
You mean like this?
-- Select customers who joined and ended anywhere between
-- 2007-05-01 and 2007-12-01 (inclusive.)
SELECT CustID
FROM tbl_CustMaster
WHERE JoinDate >= '2007-05-01' AND EndDate < '2007-12-02';
andreasblixt at 2007-11-9 13:45:38 >
# 2 Re: Comparing 2 dates
Yes thats what I mean. Thanks a lot
maverick786us at 2007-11-9 13:46:39 >
# 3 Re: Comparing 2 dates
I have a table like this

CREATE TABLE tbl_CustMaster
(
CustID BIGINT IDENTITY(1,1)
CustName VARCHAR(100),
JoinDate DateTime,
EndDate DateTime
)

Now I want to run a query in which I want to extract custID which lies between JoinDate and EndDate. Can someone help me in doing this??

SELECT CustID
FROM tbl_CustMaster
WHERE JoinDate >= '2007-05-01' AND EndDate < '2007-12-02';
technoroj at 2007-11-9 13:47:38 >
# 4 Re: Comparing 2 dates
SELECT CustID
FROM tbl_CustMaster
WHERE JoinDate >= '2007-05-01' AND EndDate < '2007-12-02';

Isnt that exactly what Andreas said? Because it is essentially a direct copy of Andreas' post it can be regarded as spam and I'll remove it in 3 days, unless you choose to return and edit it to offer some different advice.. (like BETWEEN, maybe? ;) hint hint)
cjard at 2007-11-9 13:48:33 >