Hallo Leute,
leider komme ich mit meiner Frage immer noch nicht weiter.
Wolfgang Werminghausen wrote:
In einer mit Base erstellten DB versuche ich eine Abfrage mit Filter
im Datumsfeld zu erstellen. Wie kann ich Daten (in HSQL) die mehr als
30 Tage zurückliegen filtern?
Ich habe den HSQLD-Guide zu Rate gezogen:
http://hsqldb.org/doc/guide/index.html
Die dort angegebenen Zeitfunktionen hänge ich mal unten an
Übrigens versuche ich ein gutes Anschauliches Beispiel einer
OOo-Datenbank aus der letzten linuxuser (06/06), eine einfache
Buchausleihe, nachzuvollziehen.
Mein letzter Versuch eine Abfrage für überfällige Bücher brachte
folgende Fehlermeldung, ich dachte, die HSQL-Syntax (ganz am Schluss
DATEDIFF) müsste so stimmen, oder?
Column not found: dd in statement [SELECT "STATUS"."Leihdatum",
"STATUS"."Rueckgabedatum", "AUSLEIH"."Name", "BUCH"."Autor",
"BUCH"."Titel" FROM "STATUS" "STATUS", "AUSLEIH" "AUSLEIH", "BUCH"
"BUCH" WHERE ( "STATUS"."AID" = "AUSLEIH"."AID" AND "STATUS"."BID" =
"BUCH"."BID" ) AND ( ( "STATUS"."Rueckgabedatum" IS NULL AND DATEDIFF(
"dd", "STATUS"."Leihdatum", CURRENT_DATE ) > 30 ) )]
Viele Grüße
Wolfgang
-----------------------------------------------
HSQL-Zeitfunktionen:
http://hsqldb.org/doc/guide/ch09.html#datatypes-section
CURDATE()
returns the current date
CURTIME()
returns the current time
DATEDIFF(string, datetime1, datetime2)[1]
returns the count of units of time elapsed from datetime1 to
datetime2. The string indicates the unit of time and can have the
following values 'ms'='millisecond',
'ss'='second','mi'='minute','hh'='hour', 'dd'='day', 'mm'='month', 'yy'
= 'year'. Both the long and short form of the strings can be used.
DAYNAME(date)
returns the name of the day
DAYOFMONTH(date)
returns the day of the month (1-31)
DAYOFWEEK(date)
returns the day of the week (1 means Sunday)
DAYOFYEAR(date)
returns the day of the year (1-366)
HOUR(time)
return the hour (0-23)
MINUTE(time)
returns the minute (0-59)
MONTH(date)
returns the month (1-12)
MONTHNAME(date)
returns the name of the month
NOW()
returns the current date and time as a timestamp) - use
CURRENT_TIMESTAMP instead
QUARTER(date)
returns the quarter (1-4)
SECOND(time)
returns the second (0-59)
WEEK(date)
returns the week of this year (1-53)
YEAR(date)
returns the year
CURRENT_DATE[1]
returns the current date
CURRENT_TIME[1]
returns the current time
CURRENT_TIMESTAMP[1]
returns the current timestamp
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]