Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: newbie : writing an efficient query
>
> select distinct(a1, a2) from t1 ... does not work.
> How do I write that query?
>
Jeez, I tried out the query without parantheses, and it worked!!
This parantheses thing is a bit confusing.
create table t1(a1 number, a2 number)
create table t2(a1 number, a2 number)
insert into t2 select (a1, a2) from t1 : does not work. Why? Does (a1, a2) return only one value (prob a1), when the insert stmt expects 2 values?
And why does 'primary key' construct require parantheses around the field even when the key is on just one field? create table t1(aa number, primary key aa) : does not work.
On second thought the reason is not difficult to figure out but sometimes it does get confusing as to why a simple command is not working. Particularly the syntax requiring absence of parantheses in : select distinct(aa, bb) from t1 is quite confusing. Received on Fri Aug 04 2006 - 18:36:01 CDT
![]() |
![]() |