Solved

Sqlplus - Query syntax question

Posted on 2014-03-18
3
143 Views
Last Modified: 2014-03-21
Hi,

Im running Oracle 10g and Im having a problem with a query...

My query (not sure if this would be the best way to do it) but it goes through a bunch of table that are related to get a final result.. the problem is that Im getting several duplicated results...

I know ts hard to help like this but I cant give details of the tables..


where
  subs.DPSN_DESTINATIONADDRESS is not null
  and subs.UEMTE_ID is not null
  and subs.UEMTE_ID = terminal.UEMTE_ID
  and terminal.UEMTT_ID is not null
  and terminal.UEMTT_ID = ttype.UEMTT_ID
  and ttype.UEMTT_TERMINALMODELMASTERID = tm.TCRTM_MASTERID

As you can see Im going through the tables...

Fisrt I filter the subs table, then I pass to the ternminal table using the UEMTE_ID (common in both)... then I need the UEMTT_ID to go to the ttype tabel...

The problem is that the UEMTT_ID has a common number in several rows of the ttype table... so thats shy I think Im getting dulicated results...

ANy suggestion?

Tks,
Joao
0
Comment
Question by:joaotelles
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 300 total points
ID: 39937238
please read up this article, it shall explain the "issue" and give you the path to the solution:
http://www.experts-exchange.com/Database/Miscellaneous/A_3203-DISTINCT-vs-GROUP-BY-and-why-does-it-not-work-for-my-query.html
0
 
LVL 5

Assisted Solution

by:dannygonzalez09
dannygonzalez09 earned 200 total points
ID: 39937285
have you thought about using Rank() function ? it should help you in removing the duplicates

http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions123.htm
0
 

Author Closing Comment

by:joaotelles
ID: 39945215
Tks for the articles!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question