Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: same record multiple tables
besides table aliases, don't forget your join clauses
also, the CPH column alias is unnecessary
good practice:
always use the optional AS keyword with column aliases (does not apply to table aliases)
always use table aliases (at least when more than one table is referenced)
use short, recognizable table aliases (1-4 characters) always qualify each column with the appropriate table alias (even if there is no ambiguity -- there may be later)
example:
SELECT
<c a or m>.DATE_RECEIVED as "Date Received" ,<c a or m>.cph ,<c a or m>.opt_object_id ,<c a or m>.mag_object_id
DOC_CORRESPONDENCE c
, DOC_APPLICATION a
, DOC_MOVEMENT m
WHERE
<c a or m>.CPH like '12%'
-- Mark C. Stock email mcstock -> enquery(dot)com www.enquery.com (888) 512-2048 "Clive Moore" <helloclive_at_hotmail.com> wrote in message news:d8a2d7e7271fa6281fa152be47156752.35643_at_mygate.mailgate.org...Received on Wed Nov 05 2003 - 06:58:59 CST
> I am trying to select simlar information from multiple tables in the
> following sql statement but get the following error. I understand why i
> get the error. Is there an easy way arround it.
> >
> SELECT DATE_RECEIVED"Date Received" ,cph"CPH" ,opt_object_id,
> mag_object_id From DOC_CORRESPONDENCE, DOC_APPLICATION, DOC_MOVEMENT
> WHERE CPH like '12%'
>
> SQL Exception: ORA-00918: column ambiguously defined
> >
> --
> Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
![]() |
![]() |