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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:45:19+00:00 2026-05-31T19:45:19+00:00

I have two tables; A and B. Table A contains a column of GUIDs.

  • 0

I have two tables; A and B. Table A contains a column of GUIDs. Table B contains a column of GUIDs and a column of ClientIDs. In table B, the ClientIDs may be matched to multiple GUIDs. If given 1 GUID, how would I select all GUIDs from table A that belong to the same ClientID as the given GUID?

For Example, if Table A has three rows:

Row1 | 11111111-2222-3333-4444-555555555555  
Row2 | 22222222-3333-4444-5555-666666666666  
Row3 | 33333333-4444-5555-6666-777777777777

Table B has 3 rows:

Row1 | ClientA | 11111111-2222-3333-4444-555555555555  
Row2 | ClientB | 22222222-3333-4444-5555-666666666666  
Row3 | ClientA | 33333333-4444-5555-6666-777777777777  

I am given a GUID (11111111-2222-3333-4444-555555555555), how would I write a select statement to find all GUIDs from A that match the ClientID from Table B? (11111111-2222-3333-4444-555555555555 & 33333333-4444-5555-6666-777777777777)

  • 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-31T19:45:20+00:00Added an answer on May 31, 2026 at 7:45 pm

    Eh, how about first finding the client with the given guid from table b

    SELECT client FROM table_b WHERE guid = <given_guid>
    

    and then getting all guid’s for that client from table b

    SELECT guid FROM table_b WHERE client = <client>
    

    I mean you could do it in one go using subqueries

    SELECT guid FROM table_b WHERE client IN ( 
        SELECT client FROM table_b WHERE guid = <given_guid>
    )
    

    but why complicate things

    If you need additional data from table a for the guid’s for clients, you can either JOIN or use the above as another subquery, e.g.

    SELECT guid FROM table_a WHERE guid IN (
        SELECT guid FROM table_b WHERE client IN ( 
            SELECT client FROM table_b WHERE guid = <given_guid>
        )
    )
    

    p.s. I hate using subqueries, there almost always is a better way

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables - `employee` and `department`. 1. `employee` table contains column id,employee
I have two tables, arrc_PurchActivity and arrc_Voucher. The purchase activity table contains multiple records
I have two tables: a schedule table that contains information about how an employee
I have two tables. One table contains words. Other table contains points. table words:
I have two tables called A and B . Table A contains request details
I have two tables with exactly the same fields. Table A contains 7160 records
I have two tables: attractions and cities. Attractions contains a column called city, which
I have two tables A and B. In table A, it contains two cols,
What I have are two tables: mark_notifications mark_notifications_options The mark_notifications table contains rows of
I have two tables that can be seen in accompanying image. Table A contains

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.