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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:32:56+00:00 2026-05-16T00:32:56+00:00

I have three tables, say: (1) Name: Groups Columns: gid, groupname (2) Name: Profiles

  • 0

I have three tables, say:

(1) Name: Groups

Columns: gid, groupname

(2) Name: Profiles

Columns: profileid, profname

(3) Name: GroupsProfiles

Columns: gid, profileid – corresponds to the columns in the previous tables

Now, say I have an array of profileid’s, I would like to construct a query which finds the corresponding gid in GroupsProfiles and then the corresponding groupname in Groups from that.

I have been playing about with joins and things but not quite getting what I want. Any ideas?

  • 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-16T00:32:57+00:00Added an answer on May 16, 2026 at 12:32 am

    Use a join (replace your_profile_id with the profile ID you care about):

    SELECT p.profileid
         , g.gid
         , g.GroupName
      FROM Groups g
         , Profiles p
         , GroupsProfiles gp
     WHERE g.gid = gp.gid
       AND p.profileid = gp.profileid
       AND p.profileid = your_profile_id
    

    You would run this query for each profile ID. If you want to get the information for all profiles, or for a subset of profiles, you could remove the condition on your_profile_id, or you could also use an IN clause if you know which ones you want, e.g.

    SELECT g.gid
         , g.GroupName
      FROM Groups g
         , Profiles p
         , GroupsProfiles gp
     WHERE g.gid = gp.gid
       AND p.profileid = gp.profileid
       AND p.profileid IN (profile_id_1, profile_id_2, ... ,profile_id_N)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have three tables (with the columns in each): USERS: id, name,
I have say three tables. Projects Id Name Categories Id Name ProjectCategories Id ProjectId
I have three tables say 'user', 'user_resources' and 'desktop_resources'. 'user' contains - emp_id,name and
Let's say you have three tables named Item, Event, and Seat, constructed as such:
Say I have three tables, a table of users, a table of around 500
Say I have three tables: Fruit (Table 1) ------ Apple Orange Pear Banana Produce
Lets say that I have three tables, customers, orders and orderDetails. I'm doing this:
I have three tables (individuals, groups & recordlabels) and want use the information between
I have three tables: Employee(Id,name etc) Appointment(Id,date,time,employee id, clientid etc) Client(Id,name etc) The Employee
I have a simple referrers table with three columns: Referrer //string name of partner

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.