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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:21:16+00:00 2026-05-26T05:21:16+00:00

I have a table likes , Where ID1 likes ID2 ID1 ID2 1025 1101

  • 0

I have a table likes, Where ID1 likes ID2

ID1     ID2
1025    1101
1247    1468
1316    1304
1501    1934
1641    1468
1689    1709
1709    1689
1782    1709
1911    1247
1934    1501

so i am select those who like each other, that is example

1501 1934
1934 1501

But i want to select each pair only once, and i am not able to do it. Can anyone point me in the right direction ? its a part of a bigger query, but this part i am not able to do.

Thanks

  • 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-26T05:21:17+00:00Added an answer on May 26, 2026 at 5:21 am

    To get a distinct list of all reciprocated likes you can use

    SELECT ID1,
           ID2
    FROM   likes L1
    WHERE  ID1 > ID2
           AND EXISTS(SELECT *
                      FROM   likes L2
                      WHERE  L1.ID1 = L2.ID2
                             AND L1.ID2 = L2.ID1)  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table like so; id1 id2 1 1 2 1 1 2
I have a table T1 with 60 rows and 5 columns: ID1, ID2, info1,
I have a database as: Student (ID, Name, Grade) Likes (ID1, ID2) Where ID1
I have a table that looks like this A B ID1 data 123 ID2
I have the following table ID1 ID2 Type 1 x A 1 y A
I have the following data in a mapping table: ID1 LOCALID ID2 Local_-1 BankA_7-9
I have two big tables: A: (ID1,VAR1); B: (ID1,ID2,VAR2) And a third table: C:
I have a table with two columns of ids. TABLE id1 id2 1 1
If I have a table with columns like ID1 ID2 VAL1 VAL2 Where ID1,ID2
I have a table: id1 || desc-name - 1 id2 || desc-name - 2

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.