|
Posted by Chris on 10/01/11 11:22
Hi guys,
I am having some difficulties making a sql-statement.
I took the Northwind database as an example.
I want to return the customernumbers from the orders-table, where the
orderdate is 1996/8/23 or 1996/8/27 or the whole month of september.
I came up with the following statement, but this one only returns the
customers from wich the orderdate is in the whole month of september:
select customerid from orders where orderdate in (#1996/8/23#, #1996/8/27#,
(select orderdate from orders where orderdate between #1996/9/1# and
#1996/8/30#))
I know i could do it on another way, something like:
select customerid from orders where orderdate = #1996/8/23# OR orderdate =
#1996/8/27# OR orderdate between #1996/9/1# and #1996/8/30#
But what if i want to check for 20 diferent dates? Doing like this would
make the statement very long and unreadable.
Does anyone have a suggestion?
Thanks in advance!
Chris
Navigation:
[Reply to this message]
|