Re: Select statement question
Posted in 2000
Topics: SQL Development & Query Writing
--- "Ira Rosen" <irosen1@email.mot.com> > wrote: >Is there some way with Informix to execute a select statement containing an >order by clause with 1 column such that the column in the order by clause >does not need to be output by the select statement? In other words, I want >to order output based on a column, but I don't want to see the content in my >output. I didn't see any obvious ways looking at the select syntax in the >Informix Guide to SQL Syntax document. I've worked with other databases that >have this functionality, so I'd expect Informix to offer this functionality >as well. > >-Ira Rosen >Motorola Inc. Not in an SQL statement only, but you can accomplish your task within a report. You can't order by something you are not selecting. In a report you can choose to print only the data you wish to see even if you choose not to print the column your data was sorted by. == Maintainer of the procrastinator's FAQ. Well, maybe tomorrow I will be. _____________________________________________________________ Want a new web-based email account ? ---> http://www.firstlinux.net Half.com the hottest site for DVDs, CDs & more! Get $5 off your 1st purchase of $10 or more. http://ads.adflight.com/mach1.asp?a=19061&b=46867&c=3094
This functionality was not been supported on Informix version prior to
9.30. In 9.30(soon to be released), this is possible.
Description :
-------------
In all previous versions of On-Line and IUS every column in <order by>
list must have been declared in <select clause> even in cases when the
user had no need to have this
information. This feature gives the user an option not to include an
expression in the <select clause> but specify it in the <order by>
clause.
Example :
---------
SELECT order_num, total_price FROM orders ORDER BY order_date;In all previous versions of INFORMIX, it returns error -309(ORDER BY
column column-name must be in SELECT list.ORDER BY column column-name
must be in SELECT list).
P.S : If my memory serves me right, SQL-92 enforced the restriction that
order-by list should be a subset of projection-list.
Naresh
Carlos Benjamin wrote:
>
> --- "Ira Rosen" <irosen1@email.mot.com>
> > wrote:
> >Is there some way with Informix to execute a select statement containing an
> >order by clause with 1 column such that the column in the order by clause
> >does not need to be output by the select statement? In other words, I want
> >to order output based on a column, but I don't want to see the content in my
> >output. I didn't see any obvious ways looking at the select syntax in the
> >Informix Guide to SQL Syntax document. I've worked with other databases that
> >have this functionality, so I'd expect Informix to offer this functionality
> >as well.
> >
> >-Ira Rosen
> >Motorola Inc.
>
> Not in an SQL statement only, but you can accomplish your task within a report. You can't order by something you are not selecting. In a report you can choose to print only the data you wish to see even if you choose not to print the column your data was sorted by.
>
> ==
> Maintainer of the procrastinator's FAQ. Well, maybe tomorrow I will be.
>
> _____________________________________________________________
> Want a new web-based email account ? ---> http://www.firstlinux.net
>
> Half.com the hottest site for DVDs, CDs & more! Get $5 off your 1st
> purchase of $10 or more. http://ads.adflight.com/mach1.asp?a=19061&b=46867&c=3094
--
*===========================*=====================================*
| | Informix Software Inc. |
| | Informix Center, 10th Floor, |
| Naresh Chainani | 315 SW Fifth Avenue, |
| E-mail : | Portland, Oregon 97204, USA |
| naresh@informix.com | Tel : (O) 1-503-525 7548 |
| | (R) 1-503-439 6839 |
| | Fax : (O) 1-503-721 2369 |
*===========================*=====================================*