sql - Select distinct returns duplicates -


i have following query:

select  distinct (tk.ticketid), tk.description, tk.creationdate, tk.reportedby, tk.owner, wf.assigncode ticket tk inner join wfassignment wf on wf.ownerid = tk.ticketuid tk.status not in ('ЧЕРНОВИК', 'ЗАКРЫТ', 'ВЫПОЛНЕН') , wf.assignstatus not in ('complete', 'inactive') order tk.ticketid; 

but returns duplicates in tk.ticketid attribute. , if remove other attributes ok. e.g.

tk.ticketid tk.description tk.creationdate  tk.reportedby  tk.owner     wf.assigncode О1013249    Право доступа   02.06.14        chernovdk      skachkovsv   novikovva О1013249    Право доступа   02.06.14        chernovdk      skachkovsv   prituladv О1013249    Право доступа   02.06.14        chernovdk      skachkovsv   sveshnikovav 

m.b. question simple can't solve myself. greatfull kind of help.

try this:

select  tk.ticketid, tk.description, tk.creationdate, tk.reportedby, tk.owner, max(wf.assigncode) ticket tk inner join wfassignment wf on wf.ownerid = tk.ticketuid tk.status not in ('ЧЕРНОВИК', 'ЗАКРЫТ', 'ВЫПОЛНЕН') , wf.assignstatus not in ('complete', 'inactive') group tk.ticketid, tk.description, tk.creationdate, tk.reportedby, tk.owner order tk.ticketid; 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -