Solved

Sqlplus - Query syntax question

Posted on 2014-03-18
3
141 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 142

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
oracle query help 18 99
Query question 4 37
MySQL left join performance 4 30
Query Peformance + mulitple query plans 9 47
In database programming, custom sort order seems to be necessary quite often, at least in my experience and time here at EE. Within the realm of custom sorting is the sorting of numbers and text independently (i.e., treating the numbers as number…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

912 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now