Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Order by Ddql results by selected variable then the others in a column

Re: Order by Ddql results by selected variable then the others in a column

From: Igor V. Podolsky <igoryok_at_soft-review.kiev.ua>
Date: Thu, 8 Oct 98 20:59:00 +0200
Message-ID: <AAWTAIb0pst@soft-review.kiev.ua>


÷Ô 06 ÏËÔ 98 (matthew_macfarland_at_dril-quip.com) wrote:

> Hello,
>
> Try a union query like:
>
> SELECT customerid,name,city,1 AS sort
> FROM customers
> WHERE city = 'Houston'
> UNION
> SELECT customerid,name,city,2 AS sort
> FROM customers
> WHERE city != 'Houston'
> ORDER BY sort, name

Since queries with 'union' clause have some application restrictions You can use some convertion function instead. For example:

select
  customerid, name, sity
from
  customers
order by
  decode(sity, 'Houston', ' ', sity);  

> bonanos_at_yahoo.com wrote in message <6vdjqh$6c7$1_at_nnrp1.dejanews.com>...
> >Amigos
> >
> >PL/SQL Web toolkit
> >
> >I want to do an sql statement that allows a person to select companies in
> an
> >area.
> >
> >The person chooses his suburb (area)
> >
> >The result should first showall companies in his area. and then list all
> other
> >companies.
> >
> >Must I do two sql statements.
> >
> >Muchos Gracious in advance

--
Is There A God Or Any Kind Of Justice Under The Sky... (Queen'91)

Igor V. Podolsky (igoryok_at_soft-review.kiev.ua) Received on Thu Oct 08 1998 - 13:59:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US