You are here: Re: sql statement « MsSQL Server « IT news, forums, messages
Re: sql statement

Posted by Chris on 07/18/05 19:36

thank you all for your help!


"Chris" <computertje2@hotmail.com> schreef in bericht
news:2ba80$42da3499$52ac4abf$812@news.versatel.nl...
> 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]


Удаленная работа для программистов  •  Как заработать на 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

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