Re: Union

From: "Victor Lopez" <d01m01a2000(at)gmail(dot)com>
To: "Jaime Casanova" <systemguards(at)gmail(dot)com>
Cc: "felipe fernandez" <ffdezrguez(at)tiscali(dot)es>, Postgresql <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: Union
Date: 2007-04-28 17:32:57
Message-ID: ae043d070704281032j45c9f703sf1978c56568c515f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

2007/4/28, Jaime Casanova <systemguards(at)gmail(dot)com>:
> On 4/28/07, Victor Lopez <d01m01a2000(at)gmail(dot)com> wrote:
> > Y vuelvo a mi pregunta ... ¿Que es mayor ... TRUE o FALSE ... para un ORDER BY?
> >
>
> postgres=# select * from (select true as col1 union all select false) as foo
> order by col1 ;
> col1
> ------
> f
> t
> (2 rows)
>
> postgres=# select * from (select true as col1 union all select false) as foo
> order by col1 desc;
> col1
> ------
> t
> f
> (2 rows)
>
>
> parece que true... en realidad te costaba tanto hacer la prueba?

NO

Pero si hago la prueba y me la guardo, una de las razones de estas
listas (aprender) se pierde.

De hecho, mis pruebas las tengo (de otra manera pero las tengo).

test=# CREATE TABLE test (c1 boolean);
CREATE TABLE
test=# INSERT INTO test (c1) VALUES (true);
INSERT 0 1
test=# INSERT INTO test (c1) VALUES (false);
INSERT 0 1
test=# SELECT c1 FROM test ORDER BY c1;
c1
----
f
t
(2 filas)

test=# SELECT c1 FROM test ORDER BY c1 ASC;
c1
----
f
t
(2 filas)

test=# SELECT c1 FROM test ORDER BY c1 DESC;
c1
----
t
f
(2 filas)

test=#

Solo quería confirmar para 'el publico'.

:-)

> --
> Atentamente,
> Jaime Casanova
>
> "Programming today is a race between software engineers striving to
> build bigger and better idiot-proof programs and the universe trying
> to produce bigger and better idiots.
> So far, the universe is winning."
> Richard Cook
>

--
----o---( )---o----
Saludos de Victor Lopez Sabio
d01m01a2000(at)gmail(dot)com
--------oooo--------

In response to

  • Re: Union at 2007-04-28 17:11:30 from Jaime Casanova

Responses

  • Re: Union at 2007-04-28 18:45:03 from L.S.C. Zorobabel Vega Díaz

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Omar Lòpez Andraca 2007-04-28 17:57:45 Consulta multiple en una sola tabla
Previous Message Jaime Casanova 2007-04-28 17:20:17 Re: [GENERAL] Indice en Date