![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
прошу помощи составить запрос
stud © (2005-06-23 15:54:00)есть таблица, в которой регистрируются определенные события
необходимо сделать выборку по времени до 15:00. с 15:00 до 23:00 и с 23:00 до 8:00
с первыми двумя интервалами проблем нет, но вот с третьим??? тут происходит переход через сутки.
возможно ли такое?
stud (2005-06-23 16:03:00) [21]навскидку по третьему интервалу что-то такого типа
for execute statement 'SELECT trandate,count(*) FROM ' ||tn||
' WHERE ((trantime>='||'''23:00:01'''||' and '||' trandate=trandate) '||
' and (trantime<='||'''7:59:59'''||' and trandate=trandate+1))'||
' group by trandate order by trandate' into :trandate_,:po23
do suspend;
но не работает (а должно ли?)
stud (2005-06-23 16:02:00) [22]разумеется. но как это поможет решить проблему??
сейчас в базе два поля дата и время.
забыл сказать СУБД- ФБ 1,5
Ega23 (2005-06-23 16:00:00) [23]
TDateTime is a used by the date and time routines to hold date and time values.
Unit
System
type TDateTime = type Double;
Description
Most VCL objects represent date and time values using the TDateTime type. The integral part of a TDateTime value is the number of days that have passed since 12/30/1899. The fractional part of a TDateTime value is fraction of a 24 hour day that has elapsed.
Following are some examples of TDateTime values and their corresponding dates and times:
0 12/30/1899 12:00 am
2.75 1/1/1900 6:00 pm
-1.25 12/29/1899 6:00 am
35065 1/1/1996 12:00 am
To find the fractional number of days between two dates, simply subtract the two values. Likewise, to increment a date and time value by a certain fractional number of days, simply add the fractional number to the date and time value.
Note: Delphi 1.0 calculated the date from year 1 instead of from 1899. To convert a Delphi 1.0 date to a Delphi 2.0 date, subtract 693594.0 from the Delphi 1.0 date. The date format changed to be more compatible with OLE 2.0 Automation.
В большинстве СУБД (если не во всех) этот тип поддерживается.
stud (2005-06-23 16:00:00) [24]на первые да интервала запросы вида
for execute statement 'SELECT trandate,count(*) FROM ' ||tn||
' WHERE trantime between '||'''15:00:01'''||' and '||'''23:00'''||
' group by trandate order by trandate' into :trandate_,:po15
tn - это имя таблицы, на каждый месяц своя таблица.
проблема аерехода через месяц не рассматривается!
evvcom (2005-06-23 15:57:00) [25]Возможно. Выложи, что у тебя получилось, а мы поправим.
stud (2005-06-23 15:57:00) [26]и что это даст по сравнению с дата и время?
Ega23 (2005-06-23 15:56:00) [27]используй datetime