[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: [sqr-users] DISTINCT problem
This came in somewhere in Oracle 8.1. It makes sense, if you think about
it: Suppose you have a table X
A B
--- ----
1 2
1 3
2 2
2 3
SELECT A FROM X ORDER BY B
is not a problem. But if we
SELECT DISTINCT A FROM X ORDER BY B
and there are multiple values of B for some A, what does that ordering
mean? I guess the SQL engine could figure out whether you have a
functional dependency, but throw in a function or two and it could get
tricky. An example of the error follows:
SQL> create table a (b number, c number);
Table created.
SQL> select b from a order by c;
no rows selected
SQL> c/b/distinct b
1* select distinct b from a order by c
SQL> /
select distinct b from a order by c
*
ERROR at line 1:
ORA-01791: not a SELECTed expression
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users