Re: Query

From: Eduardo Vázquez Rodríguez <evazquez(at)insys-corp(dot)com(dot)mx>
To: vhikida(at)inreach(dot)com
Cc: Postgres <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Query
Date: 2004-08-27 23:16:17
Message-ID: 412FC0C1.4010207@insys-corp.com.mx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Thanks!!!

I get the results that I wanted

vhikida(at)inreach(dot)com wrote:

> Try something like
>
> SELECT TO_NUMBER(numbers,'99999')
> FROM table
> ORDER BY 1
>
> or
>
> SELECT numbers
> FROM table
> ORDER BY TO_NUMBER(numbers,'99999')
>
> You will have a problem if one of the values in the numbers column is not
> a number.
>
>
> See http://www.postgresql.org/docs/current/static/functions-formatting.html
> for more information on "TO_NUMBER".
>
>
>
>>Hi I have a field which vaules are numbers.
>>
>>numbers
>>------
>>2
>>3
>>4
>>1
>>5
>>7
>>8
>>10
>>1
>>13
>>6
>>7
>>18
>>
>>
>>When I run a query asking for the field numbers sorted which look
>>something like this
>>SELECT numbers FROM TABLE
>>ORDER BY 1 ASC
>>
>>And I get something like this
>>1
>>10
>>13
>>18
>>2
>>3
>>4, etc
>>
>>Instead of I was expecting
>>
>>1
>>2
>>3
>>etc
>>10
>>13
>>18
>>
>>
>>How can I fix it
>>
>>Thanks in advanced
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 3: if posting/reading through Usenet, please send an appropriate
>> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
>> message can get through to the mailing list cleanly
>>
>
>
>

--
Eduardo Vázquez Rodríguez <evazquez(at)insys-corp(dot)com(dot)mx>
Consultoría Implantación
Tel. 5322 5200

In response to

  • Query at 2004-08-27 22:39:43 from Eduardo Vázquez Rodríguez

Browse pgsql-novice by date

  From Date Subject
Next Message John Browne 2004-08-28 05:07:26 Re: Questions about pg_dump file
Previous Message Eduardo Vázquez Rodríguez 2004-08-27 22:39:43 Query