Article View: be.comp.programming
Article #13703Re: SQL vraagje
From: Roelof Osinga
Date: Sun, 10 Jun 2001 21:27
Date: Sun, 10 Jun 2001 21:27
30 lines
2227 bytes
2227 bytes
Franky Claeys wrote:
>
> ...
> Ik wil nu enkel alle gegevens uit de records 23 maart 1998, 23 maart 1999,
> 23 maart 2000 en 23 maart 2001.
> ...
De specifieke antwoorden zijn al gegeven. Maar het generieke nog niet.
Dat is namelijk door gebruik te maken van SQL's DECODE() of CAST()
instructie danwel een van MySQL's extensies als DAYOFMONTH() en
MONTH(). In het laatste geval krijg je dus iets als
select count(*) where DAYOFMONTH(dd) = 23 and MONTH(dd) = 3 from T;
Welke ook in het volgende millennium het juiste antwoord zal geven als de
vraag is om alle rijen te tellen waar het veld dd van de tabel T valt
op dag 23 van de maand maart.
Roelof --
Osinga is the name,
Programming the game --
Osinga ;)
--
_______________________________________________________________________
eBOA� est. 1982
http://eBOA.com/ tel. +31-58-2123014
mailto:info@eBOA.com?subject=Information_request fax. +31-58-2160293
Technical Details
Message-ID:
<3B23E632.C4A99ACD@nisser.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!sn-xit-03!supernews.com!cyclone-sjo1.usenetserver.com!news-out-sjo.usenetserver.com!amsnews01.chello.com!Flipper.POSTED!not-for-mailReferences:
<9fsr7v$svp$1@mykenos.hogent.be>Show Full Headers
Complete Article Headers
X-Google-Language: DUTCH,ASCII X-Google-Thread: 107324,64d771637e141bf4 X-Google-Attributes: gid107324,public X-Google-Thread: fcea4,64d771637e141bf4 X-Google-Attributes: gidfcea4,public X-Google-ArrivalTime: 2001-06-10 14:27:17 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!sn-xit-03!supernews.com!cyclone-sjo1.usenetserver.com!news-out-sjo.usenetserver.com!amsnews01.chello.com!Flipper.POSTED!not-for-mail Message-ID: <3B23E632.C4A99ACD@nisser.com> From: Roelof Osinga <roelof@nisser.com> Organization: eBOA - Programming the Web X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U) X-Accept-Language: en,pdf MIME-Version: 1.0 Newsgroups: be.comp.programming,nl.comp.programmeren Subject: Re: SQL vraagje References: <9fsr7v$svp$1@mykenos.hogent.be> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Inktomi-Trace: arnink01 992208092 18906 212.187.0.39 (10 Jun 2001 21:21:32 GMT) Lines: 30 Date: Sun, 10 Jun 2001 21:27:15 GMT NNTP-Posting-Host: 212.187.37.15 X-Complaints-To: abuse@chello.nl X-Trace: Flipper 992208435 212.187.37.15 (Sun, 10 Jun 2001 23:27:15 MET DST) NNTP-Posting-Date: Sun, 10 Jun 2001 23:27:15 MET DST