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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:17:50+00:00 2026-06-06T07:17:50+00:00

I have a question on how to bind data to a datagridview in C#

  • 0

I have a question on how to bind data to a datagridview in C# when using a JOIN query with a mySql datasource, and I return one unique record from the first table and 0-2 records from a second table. My query is as follows:

SELECT t1.*, t2.org_id, t2.org_name 
FROM test.tbl_user_accounts AS t1 
INNER JOIN test.tbl_organizations AS t2 
ON t1.affiliation_one = t2.org_id OR t1.affiliation_two = t2.org_id;

It’s a school assocation, where a user can be associated with up to two schools. I want the schools to display in separate cells so a GROUP_CONCAT isn’t really a good option, and if I use GROUP BY on the t1.user_id field then I lose the second affiliation. If I don’t group, I end up with two rows for the same user.

I’m not all that familiar with joins, so it’s possible that a different type of join might solve this?

I’m using Visual C# 2010, with a mySql datasource.

  • 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-06-06T07:17:52+00:00Added an answer on June 6, 2026 at 7:17 am

    Here’s the query I used to solve this (I think I found it in another stack post, actually).

    SELECT test.tbl_user_accounts.*, t2.org_name as affil_one, t3.org_name as affil_two,t4.rank_name as rank_name
    FROM test.tbl_user_accounts 
    LEFT JOIN (test.tbl_organizations as t2) ON (t2.org_id = test.tbl_user_accounts.affiliation_one)
    LEFT JOIN (test.tbl_organizations as t3) ON (t3.org_id = test.tbl_user_accounts.affiliation_two)
    LEFT JOIN (test.tbl_ranks as t4) ON (t4.id_rank = test.tbl_user_accounts.user_rank);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have one question i'm using @RequestMapping(value = /user, method = RequestMethod.GET) public String
Question about JS Knockout library - I have three inputs, all data-Bind-ed to the
I have a question regarding primefaces datatable component. I want to bind a DataTable
Again a c# question I cant't seem to figure out: I have a datagridview
i have a question regarding some complex data-binding. I want to be able to
My question: How do I bind the SelectedItem from a primary datagrid to the
I have an html table which i bind data dynamically on the server side
I have just started using RadControls so this question might be basic for you,
I have a question about data binding which I am struggling with. I have
I have a question regarding P2P with flex. When passing data between two applications

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.