oracle - SQL: DISTINCT not working with cursor -


am facing issues sql query not returning distinct values,
having sql query below mentioned

select distinct m.firstname, m.secondname, m.creation_date,       cursor (select distinct o.certifications, o.country othertable o       o.othertable_id = m.maintable_id ) details  maintable m  m.manager_id = 100 

here maintable has 20 records respective manager (100), 1 record available below mentioned columns.

select distinct      m.firstname, m.secondname, m.creation_date       maintable m       m.manager_id = 100 

but when executed cursor returning 20 rows, without consideration of distinct.

i tried below query, need above mentioned format.

select distinct      m.firstname, m.secondname, m.creation_date, o.certifications, o.country       maintable m  left join      othertable o  on o.othertable_id = m.maintable_id      m.manager_id = 100 

could please let know, how achieve this?

this bit difficult explain, i'm going try.

your comparison query is

select distinct m.firstname, m.secondname, m.creation_date,  maintable m  m.manager_id = 100; 

however, using another column in select , being applied distinct. so, better comparison to:

select distinct m.firstname, m.secondname, m.creation_date, m.maintable_id maintable m  m.manager_id = 100; 

you expecting distinct apply values returned subquery. guessing -- because of way cursor encapsulates logic -- being applied correlation columns rather output columns. note: not 100% sure behavior, , cursor expressions not supremely documented.

i cannot think of easy way around behavior.

edit:

i think might fix problem:

select distinct m.firstname, m.secondname, m.creation_date,         cursor (select distinct o.certifications, o.country                othertable o join                     maintable m2                     on o.othertable_id = m2.maintable_id                m2.firstname = m.firstname , m2.lastname = m.lastname ,                      m2.creation_date = m.creation_date               ) details  maintable m  m.manager_id = 100; 

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -