Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7608225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:51:46+00:00 2026-05-31T00:51:46+00:00

Suppose I have the table id | name | number | address ————–+——————+———+————————————- 1

  • 0

Suppose I have the table

      id      |       name       | number  |                address
--------------+------------------+---------+-------------------------------------
 1            | channel A        |      0  | http://stream01
 2            | channel B        |      2  | http://stream02
 3            | channel C        |      16 | http://stream03
 4            | channel B        |      2  | http://stream04
 5            | channel B        |      16 | http://stream05
 6            | channel C        |      16 | http://stream06
 7            | channel A        |      7  | http://stream07
 8            | channel A        |      5  | http://stream08
 9            | channel A        |      0  | http://stream09
...etc

I want to remove duplicate channels (rows with the same name and number). But I want the result to contain the other columns along with name and number.

The problem is which id and address I choose once I’ve removed the duplicates. I’m happy to choose the first it finds. So, for example, the result from the above table should be

      id      |       name       | number  |                address
--------------+------------------+---------+-------------------------------------
 1            | channel A        |      0  | http://stream01
 2            | channel B        |      2  | http://stream02
 3            | channel C        |      16 | http://stream03
 5            | channel B        |      16 | http://stream05
 7            | channel A        |      7  | http://stream07
 8            | channel A        |      5  | http://stream08
...etc

I realise I’ll probably need a SELECT name,number FROM table GROUP BY name,number in my query and the query should start off SELECT id,name,number,address FROM (..) but I just can’t think of a way to do this in one query.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T00:51:47+00:00Added an answer on May 31, 2026 at 12:51 am
    SELECT DISTINCT ON (name,number)
           id,
           name,
           number,
           address
      FROM table
     ORDER BY name,number,id;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose you have these tables: Table Name: Salesman Fields: S_ID(Primary Key), Name Table Name:
Suppose I have the following table: PARAMETER - NAME varchar2(10) - TABLE_NAME varchar2(50) -
Suppose I have the following table: CREATE TABLE EXAMPLETABLE ( ID NUMBER(10,0) NOT NULL,
Suppose I have a table, Foo, that looks like this: ID | Name |
Suppose I have a table with columns Name VARCHAR, Department VARCHAR, Gender VARCHAR, and
I can't understand one thing. Suppose I already have these coded entities: [Table(Name =
Suppose we have this person table id name gender 1 John male 2 Kurt
Suppose I have table in my DB schema called TEST with fields (id, name,
Suppose we have a table which holds information about person. Columns like NAME or
Suppose you have a table: CREATE TABLE Customer ( batch_id NUMBER, customer_name VARCHAR2(20), customer_address

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.