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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:39:45+00:00 2026-05-27T03:39:45+00:00

Ok, so I have an organization id column named org_id in several databases. I

  • 0

Ok, so I have an organization id column named org_id in several databases.

I am writing a search function that will query two of these databases, and look for all org_id’s associated with a value in these two tables.

I ONLY want to ultimately have the org_id’s that correspond with the values I am querying for in EACH table.

For example:

Say I have an org_id of 3 that is in the tables cult_xref and cat_xref, which are both associated with an organization table, which isn’t really relevant for this. I want to ONLY pull those org_id’s which are in BOTH tables cult_xref and cat_xref, based on values I put into those tables, say 2 and 6 respectively.

So:

cult_xref

org_id     | cult_id
3          | 2
4          | 2
3          | 5

and

cat_xref

org_id     | cat_id
3          | 6
3          | 1
7          | 6

I would only want to pull the org_id’s that fulfill cult_id[‘2’] and cat_id[‘6’] at the SAME TIME.

  • 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-27T03:39:46+00:00Added an answer on May 27, 2026 at 3:39 am

    In SQL, this is called a JOIN.

    SELECT org_id
    FROM cult_xref INNER JOIN cat_xref USING (org_id)
    WHERE (cult_id,cat_id) = (2,6)
    

    For a nice introduction to joins, see A Visual Explanation of SQL Joins

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

Sidebar

Related Questions

I have an Organization model that has_many users through affiliations. And, in the form
I have a request for some contract work from an organization that uses Excel
I have two database tables that have a many to many relationship: People and
I have an organization that has clients and students, every student begins as a
I have Address and Organization tables. Address has FK named organizationID . Address class
I have the following two tables: system - id - systemName - idOrganization organization
I have these tables, organization can be a sender or receiver of many messages,
I have a table that stores the hierarchy of workgroups in our organization. It
I have an organization class class Organization { hasMany = [member:Members] } class Members
In my organization we have to answer to a separate DBA group for decisions

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.