Re: sql ERROR -309...BUG IN 7.31?
Posted in 1999
Topics: General Discussion
allenj <allenj@ndr.com> writes: > Just out of curiosity, why do I have to SELECT a column in order to > ORDER by it??? Is this some sort of ANSIism?? Seems like the engine > wouldn't give a care one way or the other.............. Probably because the ORDER BY is performed *after* the SELECT? And why would one want to order by a column that isn't selected? -- Forte International, P.O. Box 1412, Ridgecrest, CA 93556-1412 Ronald Cole <ronald@forte-intl.com> Phone: (760) 499-9142 President, CEO Fax: (760) 499-9152 My PGP fingerprint: 15 6E C7 91 5F AF 17 C4 24 93 CB 6B EB 38 B5 E5
Ronald Cole wrote: > > allenj <allenj@ndr.com> writes: > > Just out of curiosity, why do I have to SELECT a column in order to > > ORDER by it??? Is this some sort of ANSIism?? Seems like the engine Actually the ability TO sort on a column not selected is a TransactSQLism as is the ability to GROUP BY only a sub-set of the selected non-aggregate columns. ANSI SQL requires that ONLY selected columns can be named in an ORDER BY clause, yes. Only Sybase and it's progeny (SQL Server, Access, etc) support the non-standard syntax. > > wouldn't give a care one way or the other.............. > > Probably because the ORDER BY is performed *after* the SELECT? > And why would one want to order by a column that isn't selected? Art S. Kagel