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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:26:37+00:00 2026-05-26T16:26:37+00:00

I have two tables. Table 1: supportstatus clientid company status Table 2: client clientid

  • 0

I have two tables.

Table 1: supportstatus

clientid
company
status

Table 2: client
clientid
company
status
state

I am also using a table with 2 columns to seperate the grid view results. I am currently trying to make two queries that will return the clients with a disabled status in one table column and their corresponding states in the other. Any assistance with an explanation would be appreciate.

protected void queryClientCompanyName()
{
    string MyConString = "Driver={MySQL ODBC 5.1 Driver};Server=**;Database=support;User=**; Password=**;Option=3;";
    string queryString = "SELECT company FROM supportstatus WHERE status = 'disabled' Order By company";
    OdbcConnection conn = new OdbcConnection(MyConString);
    conn.Open();
    OdbcCommand command = new OdbcCommand(queryString, conn);
    OdbcDataReader reader = command.ExecuteReader();
    populateGrid(reader, GridView1);
    conn.Close();
    RecordCountLabel.Text = GridView1.Rows.Count.ToString();
}

protected void queryClientCompanyState()
{
    string MyConString = "Driver={MySQL ODBC 5.1 Driver};Server=**;Database=support;User=**; Password=**;Option=3;";
    string queryString = "SELECT cl.state FROM clients cl, supportstatus su WHERE cl.clientid = su.clientid  AND su.status='disabled' Order By cl.company";
    OdbcConnection conn = new OdbcConnection(MyConString);
    conn.Open();
    OdbcCommand command = new OdbcCommand(queryString, conn);
    OdbcDataReader reader = command.ExecuteReader();
    populateGrid(reader, GridView2);
    conn.Close();
}
  • 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-26T16:26:38+00:00Added an answer on May 26, 2026 at 4:26 pm

    You should only need the following query to replace both of yours:

    SELECT su.Company
       , cl.state
    FROM clients cl
    INNER JOIN supportstatus su ON cl.clientId = su.clientId
    WHERE su.status = 'disabled'
    Order By cl.company
    

    You want one query that will return both values so you know that they are related. It is because of this that you want to join the tables together. I just did a quick google search and W3schools has basic join information, so does techrepublic These should help you with the basic concepts of querying a database.

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

Sidebar

Related Questions

I have two tables. client(clientid, company, state, status) and supportstatus(clientid, company, status, agreement). Shouldn't
I have two tables in my database: NEWS table with columns: id - the
I have two tables with similar columns - let's say table A with column
Let's say I have two tables: Table: Color Columns: Id, ColorName, ColorCode Table: Shape
I have two tables suppose table 1 has two columns with short names and
I have two tables Table 1 Date ID State 3/22 1 state 1 3/21
I'm using EF4.1 POCO. I have two tables [Table(Parent)] public class Parent { public
My question is: I have two tables: table A has two columns (KeyA and
I have two tables Table : 1, Name : NdcAwp, Columns-Ndc, AwpUnitCost Table :
Let's say I have two tables: Table 1 has the columns NOTE_ID (a unique

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.