SQLTeam.com | Weblogs | Forums

Where condition with multiple columns


#1

I have done a lot of searching and I just can't figure out how I would write in SQL:

WHERE COLUMN_ID has a COLUMN_DATE between COLUMN_START_DATE and COLUMN_END_DATE

Should there be something in HAVING? If someone could point me in the right direction.

Thanks!


#2
SELECT Column_ID, Column_Date
FROM MyTable
WHERE Column_Date BETWEEN Column_Start_Date AND Column_End_Date;
-- Or possibly
SELECT DISTINCT Column_ID 
FROM MyTable
WHERE Column_Date BETWEEN Column_Start_Date AND Column_End_Date;

No Having needed with the criteria you stated.