tags:

views:

22

answers:

1

I am trying to create a SQL query that checks if a date is in a list of dates but my query doesn't work...

SELECT * 
FROM TABLE1
WHERE field1 = value1
  AND convert(nvarchar(15),date_start,101) IN 
    (SELECT convert(nvarchar(15),date_end,101) 
             FROM TABLE2
         )

This query should return some values but it doesn't...

+3  A: 

do not convert the data i think there is no need for this

Try this :

SELECT * 
FROM TABLE1
WHERE field1 = value1
  AND date_start IN 
    (SELECT date_end FROM TABLE2)
Pranay Rana