Solved

Sqlplus - Query syntax question

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 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