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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:15:17+00:00 2026-05-13T06:15:17+00:00

I am working with a SharePoint web part that I am designing in C#.

  • 0

I am working with a SharePoint web part that I am designing in C#. I need to query a SQL Server 2005 database to return the names of machines that are associated with a particular customer, selected by the user.

The problem is that there are different types of machines, and the names themselves are stored in several other tables. Here is the structure as it pertains to this question:

I have a table “customerInfo” which contains the ID and name of each customer. The ID is the primary key.

A table “machineIDs” links the customer IDs to the corresponding machine IDs. The machine ID is the primary key.

I have two tables for two types of machines, “machine1” and “machine2.” machine1 contains the name of the machine itself, but machine2 only contains the ID of the type of machine it is. With both of these tables, the machine ID is the primary key.

Then I have a table “specialtyMachine.” This table contains the name of the machine and the ID of this type of machine. The primary key here is a type ID, which identifies the type of machine, whereas the machine ID identifies the specific machine.

What I need to do is pull the machine name from machine1 and specialtyMachine, given just the customer ID. I’m not sure whether it’s possible to do this with a complex join directly within the query, or if I will need to apply logic in the web part to pull this information together.

I would also like to know how I can think about this in terms of a generic model. I’d like to be able to recognize this and apply it generically in the future, as I’m sure it’s a fairly common problem that I just haven’t dealt with yet. Thank you.

  • 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-13T06:15:18+00:00Added an answer on May 13, 2026 at 6:15 am

    Based on your new schema information I’m guessing this is what you want:

    select *
    from customerinfo c
    left join machineids mids on c.customerid = mids.customerid
    left join machine1 m1 on mids.machineid = m1.machineid
    left join spcialtymachine sm on mids.machineid = sm.machineid -- or m1.machineid = sm.machineid
    left join machine2 m2 on sm.typeid = m2.typeid
    

    note: if you are using this in a stored procedure with an @customerid as a parameter you can add a where c.customerid = @customerid to the end.

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

Sidebar

Ask A Question

Stats

  • Questions 264k
  • Answers 264k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer What version of F# do you have? This sounds maybe… May 13, 2026 at 12:18 pm
  • Editorial Team
    Editorial Team added an answer There are probably a few ways to optimise the sub-queries,… May 13, 2026 at 12:18 pm
  • Editorial Team
    Editorial Team added an answer You can use SplObjectStorage from the SPL as a map… May 13, 2026 at 12:18 pm

Related Questions

I am currently working on a custom SharePoint web part (WSS 3.0, not MOSS)
I am playing around with Sharepoint 2007. I have a virtual machine (win server
I've built a web part for Sharepoint that retrieves data from an external service.
I have a web.config file on my computer. There are alot of things i
I am working with a custom list I've built in SharePoint. I have a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.