[Solved] Queries and dates

Creating tables and queries
Post Reply
carles
Posts: 5
Joined: Mon Apr 28, 2008 11:32 am

[Solved] Queries and dates

Post by carles »

Hi everyone,
I have a table, let's say

child(name varchar(50) primary key,
birth_date date not null)
table.PNG
table.PNG (14.07 KiB) Viewed 1557 times
and some data
data.PNG
data.PNG (8.22 KiB) Viewed 1557 times
and i want to make a query to show wich is the birth_date of the older child in de db. So i make a qwery with an aggregate function like this
min(birth_date)

but, instead of showing a date, the query shows a number.
query.PNG
query.PNG (12.49 KiB) Viewed 1557 times
How can i transform this number into a date?

Thanks
carles
Last edited by carles on Wed Apr 30, 2008 10:01 am, edited 1 time in total.
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: queries and dates

Post by Villeroy »

First I thought you found a way to convert dates to numbers which could open some options to calculate with day-offsets ("BirthDate"-99), but CAST(MAX("Date") AS DATE) raises an error that Java can not convert "yyyy-mm-dd" to number ... just like CAST(39536 AS DATE).
Anyway, the displayed number is a date, which seems to be converted to number by the Base frontend. Save your query, close, re-open, change the number format for each column and save (seems to fail when done in a single step).
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
carles
Posts: 5
Joined: Mon Apr 28, 2008 11:32 am

Re: queries and dates

Post by carles »

Ok! That works. By the way, you can do it in one step if you write the query, execute it without saving, and then change the format of the colum with the number to a date format. Then you can save it.

Thanks

carles
Post Reply