Re: Alternative to AS?

From: Helgi Örn <sacredeagle(at)gmail(dot)com>
To: Nathaniel Trellice <naptrel(at)yahoo(dot)co(dot)uk>, PostgreSQL - newbie <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Alternative to AS?
Date: 2010-10-06 18:36:46
Message-ID: AANLkTikYmg4CLjAu=QkPYFXu0LDAfvknkOntcjD2PO9M@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Thank's for your effort Nathaniel.

2010/10/6 Nathaniel Trellice <naptrel(at)yahoo(dot)co(dot)uk>:
> Hi Helgi,
>
> I think your problem is not the 'AS', but is the way you're trying to format the time.
>
What I'm trying to do is fetch time from the database and transform it
into a 'human readable' format.

> I don't know what 'tid_in' is, but you might have some luck trying something along the lines of:
>
tid_in is the name of the column that is type TIME

> SELECT tid_in, to_char(tid_in, 'HH24.MI') AS format FROM timmar;
>
This does not work at all.

> The section 'Data Type Formatting Functions' (chapter 9.8) may be of a little help.
>
Believe me, I have read through this but in this case it hasn't helped
me the least. What I miss in the postgres documentation i samples

> Nathaniel
>
>
> On 6 Oct 2010, at 09:58, Helgi Örn <sacredeagle(at)gmail(dot)com> wrote:
>
>> Hi! I am moving a database project from MySQL to PostgreSQL I was a
>> newbie there and now I am a newbie here :)
>>
>> I have this form mysql:
>> SELECT tid_in, TIME_FORMAT(tid_in, '%H.%i')AS format FROM timmar;
>>
>> Which I have gotten postgre to accept thus far:
>> SELECT pack_tidin TIME_FORMAT, pack_tidin '%H.%i', AS format FROM timmar;
>>
>> it stops at AS which doesn't seem to exist is postgre, what is
>> postgres alternative to AS?
>>
>>
>> Thank's in advance,
>> Helgi Örn
>>

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Thomas Kellerer 2010-10-06 19:07:04 Re: Alternative to AS?
Previous Message Christian Ramseyer 2010-10-06 11:40:46 Re: Alternative to AS?