Re: Select statement question
Posted in 2000
Obnoxio The Clown wrote: > From: "Ira Rosen" <irosen1@email.mot.com> > >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. > > And which databases were these? > > In a nutshell, it's an ANSI requirement that something you order by is in > the select list, so, no. Oracle, Sybase, SQL Server, probably DB2, MySQL, Postgres, ... You're right, Obnoxio; ANSI SQL does require it. However, Informix is virtually the lone holdout in also requiring it. The fact that it is a bad idea to have data sorted on criteria you can't see in the result set is irrelevant, at some levels. We ignore the standard whereever else it is convenient to do so; we should not get hung up on this detail, either. -- Yours, Jonathan Leffler (Jonathan.Leffler@Informix.com) #include <disclaimer.h> Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN "I don't suffer from insanity; I enjoy every minute of it!"