Hello! I'm doing an ADF application wrote a query:

SELECT q.nlitera, q.schange, q.scode, q.sname, q.npagecount, q.skeywords, q.dcarddate, q.niswork, q.nisrevoked, q.scomment, q.ndocumentid, w.sname, e.scode, r.sname, t.sname, y.sname, u.sname, u.sname FROM ibd_documentcard q, ibd_documenttype w, ibd_department e, ibd_pageformat r, ibd_storingplace t, ibd_clgroup y, ibd_user u WHERE q.ntypeid = w.ntypeid(+) AND q.ndepartmentid = e.ndepartmentid(+) AND q.npageformatid = r.npageformatid(+) AND q.nstoringplaceid = t.nstoringplaceid(+) AND q.nclgroupid = y.nclgroupid(+) AND q.nuserid = u.nuserid(+) AND q.nresponsibleid = u.nuserid(+); 

The data is displayed on the form and everything is okay, but when I try to find something, it displays an error:

ORA 00918 column is ambiguously determined

Point a finger where I was wrong ((((

    1 answer 1

    The query retrieves values ​​of columns with the same name r.sname,t.sname,y.sname,u.sname,u.sname .

    If you wrap this query with the following -

     select sname from ( 

    How Oracle will know which field needs to be extracted? Therefore, to get rid of ORA-00918, for each column that has several repetitions (for example, sname), it is necessary to prescribe a unique alias -

     ...r.sname as r_name, t.sname as t_name, y.sname as y_name,...