SQL query question: SELECT … NOT IN

前端 未结 7 1164

I am sure making a silly mistake but I can\'t figure what:

In SQL Server 2005 I am trying select all customers except those who have made a reservation before 2 AM.<

7条回答
  •  粉色の甜心
    2020-12-24 06:00

    Sorry if I've missed the point, but wouldn't the following do what you want on it's own?

    SELECT distinct idCustomer FROM reservations 
    WHERE DATEPART(hour, insertDate) >= 2
    

提交回复
热议问题