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

  • Home
  • SEARCH
  • 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 8789099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:18:31+00:00 2026-06-13T22:18:31+00:00

I have 3 tables like this: table_1 +-ID-+-table_3_id-+ | 1 | 1 | |

  • 0

I have 3 tables like this:

table_1

+-ID-+-table_3_id-+
|  1 |          1 |
|  2 |          1 |
|  3 |          2 |
+----+------------+

table_2

+-ID-+-table_1_id-+-name--+-value-+
|  1 |          1 | Name1 | Data1 |
|  2 |          1 | Name2 | Data2 |
|  3 |          1 | Name3 | Data3 |
|  4 |          2 | Name1 | Data1 |
|  5 |          2 | Name2 | Data4 |
|  6 |          2 | Name3 | Data5 |
|  7 |          3 | Name1 | Data6 |
|  8 |          3 | Name2 | Data2 |
+----+------------+-------+-------+

table 3 consists of IDs and other data that is irrelevant to this question. However, I need to be able to filter on table_3_id.

This is what I need:
Table 2 has multiple rows that have information of the rows in table_1. I need to have a query that checks if there are duplicates in the ‘data’ column, which have the same ‘name’. The result I need would be this (with a WHERE table_3_id = 1):

+-table_3_id-+-name--+-value-+-duplicate-+
|          1 | Name1 | Data1 | true      |
|          1 | Name2 | Data2 | false     |
|          1 | Name3 | Data3 | false     |
+------------+-------+-------+-----------+

Or, if possible, only return the data from table_2 where it actually is a duplicate. The ‘duplicate’ field can be a count too, since I do know the amount of rows that have the same table_3_id.

I hope I have made my question clear enough. If it is not clear enough I will try to improve it. I have tried it with joins and subqueries, but my knowledge of SQL isn’t enough to make an advanced query like this. I’d prefer this in a single query instead of multiple in PHP.

  • 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-13T22:18:32+00:00Added an answer on June 13, 2026 at 10:18 pm

    You can use something along the lines of the below:

    select Name
    from table
    group by name
    having count(*) > 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have three different tables like this table_1 Field 1: victories Field 2:
I have Two tables like this: Table categories: columns: id, name, parent 1, Foods,
I have 2 tables like this Table 1 id name 1 ABC 2 DEF
I have three tables like this: Table 1 structure: Name: registered_applicant_details Fields: applicant_id INT
I have two tables like this: Table Name: users emx | userid --------------- 1
Suppose I have a query like this: SELECT t1.name, t2.likes FROM table_1 t1 LEFT
I have a couple of tables which look like this Table 1 user_id |
I currently have two tables that look something like this: Table 1 Id |
Hi i have tables like this : table entry : id | total_comments _____________________
I have a two tables that look like this (this is an example of

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.