Article View: pl.comp.lang.delphi.bazy-danych
Article #82295Re: Zapytanie sql
From: wloochacz
Date: Mon, 11 Aug 2014 10:33
Date: Mon, 11 Aug 2014 10:33
29 lines
2328 bytes
2328 bytes
W dniu 2014-08-11 01:55, set pisze: > Wita,m ,potzrebuję pomocy w zapytaniu sql, jest kolumna godzina, gdzie > podany jest czas w postaci gg:mm:ss Jaki typ jest tej kolumny? Bo to, że Ty tak widzisz czas to wcale nie znaczy że on jest zapisany "w takim formacie"... > musze wybrac rekordy gdzie jest pelna > godzina czyli np 10:00:00 , 11:00:00, ale je¶li takie pole nie występuje to > najbliższe wcze¶niejsze czyli jak nie ma 10:00:00 to wybrac 09:59:59 czy > 09:59:58 czy co tam występuje bo czasy s± różne Jak baza danych? A każda z baz ma wbudowane funkcje do rozbioru daty na części: Dla MSSQL: http://msdn.microsoft.com/en-us/library/ms174420.aspx http://stackoverflow.com/questions/1923876/sql-server-convert-intyear-intmonth-intday-to-datetime Dla Firebird: http://www.firebirdsql.org/refdocs/langrefupd21-intfunc-extract.html Dla MySQL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html Reszta "algorytmu" to trochę IFów i po sprawie... I, być może, dobrze by było napisać sobie funcje w SQL, która będzie robiła dokładnie to co potrzebujesz. -- wloochacz
Technical Details
Message-ID:
<53e89c0b$0$2146$65785112@news.neostrada.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!news.cyf-kr.edu.pl!news.nask.pl!news.nask.org.pl!news.unit0.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.neostrada.pl!unt-exc-02.news.neostrada.pl!unt-spo-a-01.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mailReferences:
<ls91re$cs1$1@mx1.internetia.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!news.cyf-kr.edu.pl!news.nask.pl!news.nask.org.pl!news.unit0.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.neostrada.pl!unt-exc-02.news.neostrada.pl!unt-spo-a-01.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail Date: Mon, 11 Aug 2014 12:33:46 +0200 From: wloochacz <wloochacz@no.spam.gmail.com> User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 Newsgroups: pl.comp.lang.delphi.bazy-danych Subject: Re: Zapytanie sql References: <ls91re$cs1$1@mx1.internetia.pl> In-Reply-To: <ls91re$cs1$1@mx1.internetia.pl> Lines: 29 Message-ID: <53e89c0b$0$2146$65785112@news.neostrada.pl> Organization: Telekomunikacja Polska NNTP-Posting-Host: 83.25.122.243 X-Trace: 1407753227 unt-rea-a-02.news.neostrada.pl 2146 83.25.122.243:47338 X-Complaints-To: abuse@news.neostrada.pl X-Received-Bytes: 2032 X-Received-Body-CRC: 3963826074 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit