Skip site navigation (1) Skip section navigation (2)

Re: Query Problem!!

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: christiangda(at)cantv(dot)net
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Query Problem!!
Date: 2001-01-15 00:40:39
Message-ID: 13149.979519239@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
<christiangda(at)cantv(dot)net> writes:
> <DIV><FONT face=3DArial size=3D2>I have PostgreSQL v7.02 in RedHat 6.2;</FO=
NT> </DIV>
> <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3DArial size=3D2>I have problem with is Query:</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>select name, 'user' as class from smuser u=
> nion=20
> select name, 'group' as class from smgroup order by class;</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>

Please turn off HTML mail :-(

The problem is with the nonspecific-type literals; 7.0 won't resolve
those to a particular datatype by itself, so it doesn't know how to sort
them.  Try

select name, 'user'::text as class from smuser
union
select name, 'group'::text as class from smgroup
order by class;

			regards, tom lane

pgsql-bugs by date

Next:From: Antonio Da SilvaDate: 2001-01-15 10:51:25
Subject: Problem
Previous:From: Yoshihiko IchikawaDate: 2001-01-15 00:30:57
Subject: Re: Query Problem!!

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group