age in another column

31 views
Skip to first unread message

sieg...@skerra.net

unread,
Sep 29, 2020, 5:21:33 AM9/29/20
to H2 Database

Hello
I export data from an H2 database and save it in a CSV.

T
hat's going well.
I would like to save the age in another column.

Age =
current date - Date of birth (GEBURTSDATUM)

Is that possible.

CALL CSVWRITE('C:\Nextcloud-KCH\Vorstand\KC-Adressen\KC-Mitgliederadressen.csv',
'SELECT ANREDE,TITEL, NAME, VORNAME, STRASSE, PLZ, ORT, TELEFONPRIVAT, HANDY, EINTRITT, GEBURTSDATUM, EMAIL
FROM PUBLIC.MITGLIED
WHERE BEITRAGSGRUPPE IS NOT 56 ORDER BY NAME, VORNAME asc',
'charset=windows-1250 escape=" fieldDelimiter=" fieldSeparator=; writeColumnHeader=true');

Siegfried

Andreas Reichel

unread,
Oct 7, 2020, 9:32:51 AM10/7/20
to H2 Database
Siegfried,

you will need to calculate the Date Difference in days divided by 365 as shown in the following example:

select Cast({d '2019-05-04'} - {d '2019-03-12'} AS DECIMAL) /365 from dual;

Cheers
Andreas
Reply all
Reply to author
Forward
0 new messages