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 9172751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:25:32+00:00 2026-06-17T16:25:32+00:00

I have a MySQL table which has the following structure: mysql> select id,channel,Stats,Bridged from

  • 0

I have a MySQL table which has the following structure:

 mysql> select id,channel,Stats,Bridged from channels;
 +----------+---------------------------------+---------+-------------------------------+
 | id       | channel                         | Stats   | Bridged                       |
 +----------+---------------------------------+---------+-------------------------------+
 | 21523318 | SIP/5602291658-0007f140         | Up      | SIP/X.Y.Z.Q-0007f13f          >      |
 | 21523321 | SIP/X.Y.Z.Q-0007f13f            | Up      | SIP/5602291658-0007f140       |
 | 21523322 | SIP/5154642553-0007f13a         | Up      | SIP/402-0007f135              |
 | 21523323 | SIP/402-0007f135                | Up      | SIP/5154642553-0007f13a       |

Look at each two records, they are paired: for example ID 21523318 has Channel identical with Bridged column from next ID.

My question is: taking into account that the table usually holds several thousands entries, how could I select a single line for each two records?

I mean — once I have the first line and I can verify that the “Bridged” column info exists as “channel” in the db, to display a single line. I can do this recursively (checking for each line if there’s another Bridged channel , but for several thousands it becomes very slow and there are a lot of queries.
I was thinking of doing inner join with the same table on channel=Bridged and then somehow do a group by or something…

Any clues or ideas on how I should proceed?

  • 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-06-17T16:25:33+00:00Added an answer on June 17, 2026 at 4:25 pm

    If channel and bridged are always swapped, this should work for you:

    select *
    from channels
    where id in (
      select min(id)
      from channels
      group by least(channel, bridged), greatest(channel, bridged))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table which is being dynamically populated from MySQL. The table has
I have a MySQL table which has a product_id field (big integer) 1102330008 1102330025
I have a huge MySQL table which has its rows encoded in UTF-8 twice.
if i have a table which has columns with fixed lenght, Will mySQL count
I have a table in MySQL 4.0 which currently has a year field as
In my PHP application, I have a mysql table of articles which has the
I have the following simple MySQL query: SELECT SQL_NO_CACHE mainID FROM tableName WHERE otherID3=19
I have MySQL table with the following structure: +---------+--------------+------+-----+---------+----------------+ | Field | Type |
I have a table in mysql which has just on record. when I execute
I have a MySQL table that has a column called title which is a

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.