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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:40:55+00:00 2026-05-18T00:40:55+00:00

I am new to sql so please bear with me here. I have two

  • 0

I am new to sql so please bear with me here.
I have two tables, COURSES and RESPONSES which have a common field userID. I am making a grid view which displays each users available courseName from the COURSES table and dateTaken from the RESPONSE table. So I simply wrote the query as:

SELECT c.*, r.*
FROM COURSES c, RESPONSE r
WHERE c.userID = @userID1 and r.userID = @userID1 and r.userResponse = NULL

<SelectParameters>
    <asp:Parameter Name="userID1" Type="Int32" />
</SelectParameters>
<asp:GridView
            ID                      ="gvAvailCourses"
            runat                   ="server"
            DataSourceID            ="sdsAvailCourses"
            Width                   ="100%"
            DataKeyNames            ="trainingCourseID"
            PageSize                ="10"
            AllowPaging             ="true"
            EnablePersistedSelection="true"
            OnRowCommand            ="gvAvailCourses_RowCommand"
            AutoGenerateColumns     ="false">


            <Columns>

                <asp:BoundField DataField="trainingCourseID" HeaderText="Coursen ID" />
                <asp:ButtonField ButtonType="Link" DataTextField="CourseName" CommandName="CourseName" HeaderText="Course Name" />
                <asp:BoundField DataField="dateEntered" HeaderText="Last Taken" />

The RESPONSE table may or may not have a record of a users response, so there may be no record for a particular userID.

In any case, I have to display in my grid view, any couseName that is in the COURSES table regardless of its value in the RESPONSE table. If the RESPONSE table does not have a record for that user, then the grid view will just display blank there or say “Not Taken Yet” for the dateTaken column. My above query does not display anything at all if there is no record in the RESPONSE table.
Please help.

Thanks!

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

    What you’re looking for is a LEFT OUTER JOIN. This allows the second table to be included in the query if there is information present, otherwise the referenced columns will return NULL values.

    SELECT          c.*, r.*
    FROM COURSES    c
      LEFT JOIN     RESPONSE r
      ON            r.userID = c.userID
    WHERE           r.userResponse = NULL
    

    Check out inner joins and left/right modifiers thereof.

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

Sidebar

Related Questions

Can anyone please help me on the following: I have created a SQL Server
I'm currently setting up my website on a new SQL Server 2008 server, however
I am new to SQL Server 2008 Full Text index function. I am learning
am using C#, VS 2005 and SQL 2000 I have date conversion problem my
help me please with this simple E-sql query: var qStr = SELECT SqlServer.Month(o.DatePaid) as
I'm pretty new to Servlets and JSP and to using databases. At the moment
*Edit: Please see my answer below for the solution. Is there any danger in
I had stored procedure which get data where Id=@id and the @id which pass
I had Repeater control which had image control sometimes this image control hadnot data
I am going to pay for some classes to learn MS SQL server 2008.

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.