Reply to sql statement

Your name:

Reply:


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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация