Duplicate address with unique column

Rating8.2Very Good

I need to create a file of addresses which contains information from several tables.  This file is to contain only unique name and addresses.  I can do this with no problem (either with group by or distinct).

My problem is I need to add a column to the file that is a unique number.  Being a unique number, group by and distinct will return every row.  Is there an easy/efficient way to select distinct addresses and include either the first or last unique number for each address?

  1. Query or stored procedure to return next unused…
    This hopefully is an interesting question for someone, and maybe there are some elegant solutions already out there. What I have is a table that contains a name field for a company. This name field is obviously a varchar, BUT, some of our clients only use numbers as their names. This table can be populated either via my application, or via an import ro…
  2. Report Builder 6i: How to get the Group Page N…
    Hello! I have a report and I need to get the page number of the group. I mean I have a repeating frame grouped by a field. Every group may have 1,2,3,4... pages. When the group column changes the group number resets at 1, e.t.c. How can I get the page numbering of every group and display it on the layout? Thank you in advance!
  3. retrieving distinct rows from table.
    select * from users u, userreports ur, reportcolumns rc where ur.rid = rc.rid and UR.RID = 221 and RC.ID = 1514 and u.deleted = 0 There are many rows with same user, I want to get only one user. How do I do that? I need to get rows with distinct usernames, but at the same time retrieve remaining columns as well…
  4. Reveal Counts of the Distinct Values of each Col…
    Hello Experts. I am searching for an efficient way to analyze multiple tables in the effort to reveal the counts of the distinct values in each of the table's columns. As an example, the following table, EMPL_SPECS, holds the following data: Key Name Location Yrs_Srvc Start_Dt 1 John A 5 4/1/2004 2 Mary …
  5. Trying to group columns by distinct numbers usin…
    If I do the following query I correctly get a count for each distinct number as DEPT COUNT HR 10 OPS 5 STAFF 2 select DEPT, count(DEPT) from table_name group by DEPT; But if I use CASE statements I'm not sure of a way to have a result that is grouped by DEPT. If I try the following query I get this error '…


Sign up now to view this solution! It's quick, easy, and secure to subscribe. We will return you to this solution, unlocked, when you’re done.

About this Solution
View This Solution - Start Your 30 Day Free Trial
Participating Experts
Solution Grade



All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

by: mshaikh

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

Stay Connected

Oracle Around the Web

The latest Oracle news, tips, and tricks

Oracle Unveils Netra SPARC T3 Servers

New Carrier-Grade Blade and Rackmount Servers Deliver Better Performance, Density and Power Efficiency for the Communications Industry ...

read more

Oracle fixes 21 flaws in Java SE, Java for Business

Oracle is fixing 21 flaws in its Java SE and Java for Business products in its February critical patch update issued this week ...

read more

Obama’s Silicon Valley “Tech Supper”

Why was he there? Who wasn’t invited and why? What did they talk about? Why was he really there? These are the questions being debated ...

read more

Featured Oracle Experts


slightwv has answered more than 2,000 Oracle questions and oversees database management within the U.S. Government. Slightwv


A regular presenter at the Collaborate conference, Oracle developer sdstuber is a top expert in PL/SQL and Oracle 9, 10 and 11. sdstuber


What users are saying about our experts

"The Oracle gurus provide answers, solutions and valuable workarounds"

User: schwertner

"Wow! Excellent, valuable explanation. Hats off to you"

User: aseshu70

"Solution worked fantastic and performs excellent! Thanks heaps"

User: klausbrandlhuber

Top Experts

  1. slightwv


    0 points yesterday


BrowseBecome an Expert