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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:16:47+00:00 2026-05-15T20:16:47+00:00

I have an assignment table in my database. I also have a assignment_notes table,

  • 0

I have an assignment table in my database. I also have a assignment_notes table, which has a reference to the assignment table. There can exists multiple rows in this table.

When I select all my assignments, I want to check if there exists some notes to this assignment. And all I want is a true/false return.

Is it possible to do something like (pseudo):

Select all assignments; if assignment
has assignment_notes HasNotes = true; else
HasNotes = false.

I hope I made this clear enough – I’m not so good at explaining programming stuff 😉

  • 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-15T20:16:48+00:00Added an answer on May 15, 2026 at 8:16 pm
    DECLARE @Assignments TABLE
    (
        Id INT NOT NULL IDENTITY(1,1) PRIMARY KEY,
        Name VARCHAR(30) NOT NULL
    )
    
    DECLARE @AssignmentNotes TABLE
    (
        Id INT NOT NULL IDENTITY(1,1) PRIMARY KEY,
        AssignmentId INT NOT NULL,
        Note VARCHAR(MAX)
    )
    
    INSERT INTO @Assignments(Name) VALUES('Biology')
    INSERT INTO @Assignments(Name) VALUES('Chemistry')
    
    INSERT INTO @AssignmentNotes (AssignmentId, Note) VALUES(1, 'Studies on DNA')
    INSERT INTO @AssignmentNotes (AssignmentId, Note) VALUES(1, 'Evolution notes from Darwin')
    
    SELECT
        A.*,
        CASE WHEN COUNT(AN.Id) > 0 THEN 1 ELSE 0 END AS HasNotes    
    FROM    
        @Assignments AS A
        LEFT JOIN
        @AssignmentNotes AS AN
        ON A.Id = AN.AssignmentId
    GROUP BY
        A.Id,
        A.Name
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database which contains an Assignment table. The table looks like this:
I have this table relationship It's a job assignment database in which, as soon
I have a MySQL database which contains a table of users. The primary key
I have a database assignment which I have to create some relational algebra for
I have an assignment in which I have to allow a user to plot
I have to use SQLPLUS for my database class, and our first assignment is
I have Assignment due in which i'm stuck on a question. Add a Sales
In my scheduling database, I have an assignments table with the following fields: |
I have an assignment where I am to create two tables within a database.
I'm creating a database with oracle and php for an assignment and i have

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.