Re: Quick question about syntaxis....

From: Rauf Sarwar <rs_arwar_at_hotmail.com>
Date: 8 Jun 2003 15:42:50 -0700
Message-ID: <92eeeff0.0306081442.60ea511b_at_posting.google.com>


"Juan Guillermo Fernández V." <promodeus_at_hotmail.com> wrote in message news:<bbvqin$oof$1_at_news1.nivel5.cl>...
> Just wandering.... Is there any syntaxis that allows for a "Select all but
> one column"? I'm working with a 28 columns table, and I need to select 25 of
> those fields... and I feel there have to be a way to select those more
> efficiently than declaring them one by one.

Create a view and only include 25 columns or write your query once and save it in an ascii file. Then you would probably ask if "there is an efficient way to select only 20 of those coloumns...".

>
> Oh, and another one. In a simple SELECT * FROM Table1 T1,Table2 T2 WHERE
> T1.id_t2=T2.id_t2 ORDER BY id_t2;
>
> it states "ORA-00918: column ambiguously defined". Obviously that's due 2
> colums sharing names on both tables... but, also obviously, it doesn't
> matters wich one to order by, 'cause they both share the same value. Any
> elegant way to avoid the reference to the table name on that last one
> ('ORDER BY T1.id_t2' or 'ORDER BY T2.id_t2')?
>

Use column index e.g. ORDER BY 1 (First column in query) or ORDER BY 2 etc.
However... it is generally a good practice to alias your table/view names in a query, even when there is only one table/view referenced.

Regards
/Rauf Sarwar Received on Mon Jun 09 2003 - 00:42:50 CEST

Original text of this message