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

The Archive Base Latest Questions

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

I have inherited a system which seemingly requires me to use a cursor or

  • 0

I have inherited a system which seemingly requires me to use a cursor or while loop.
Given the below tables, I would like to get the names of the attendees e.g

Bill
Bob
Jane
Jill

Attendees
SourceTable|SourceTableId
Boys |1
Boys |2
Girls |2
Girls |1

Boys
Id|FirstName
1 |Bill
2 |Bob

Girls
Id|FirstName
1 |Jill
2 |Jane

Note, the system doesn’t actually use Attendees,Boys & Girls but rather uses Contracts, Orders and other such entities etc but it was easier\simpler to represent in this form.
There may be loads more lookup tables than just “boy” and “girl” so

Is there anyway I can achieve this by not using cursors or other row based operations.

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

    If I understand this query should work:

    SELECT FirstName
      FROM Attendees
      join Boys on id = SourceTableId
     WHERE SourceTable = 'Boys'
    union all
    SELECT FirstName
      FROM Attendees
      join Girls on id = SourceTableId
     WHERE SourceTable = 'Girls'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have inherited a java system which should be run in the background on
I have some inherited code which stores SMTP server, username, password in the system.net/mailSettings/smtp
I have inherited a new (old?) Winforms project and would like to put it
I have my own textbox which inherits System.Windows.Forms.TextBox I am trying to display texts
I have a BasePage which inherits from System.Web.UI.Page , and every page that inherits
I have Default.aspx page, which inherits from BasePage.cs, which inherits from System.Web.UI.Page. BasePage is
I have inherited a middle tier system with some multi-Threading issues. Two different threads,
I have inherited a client site which crashes every 3 or 4 days. It
I have inherited an old crusty PHP application , and I'd like to refactor
I have inherited some legacy vb6 code. It's a tool which generates a local

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.