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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:12:23+00:00 2026-05-24T21:12:23+00:00

I am developing some hardcoded reports from embedded Java code to Crystal Reports there

  • 0

I am developing some hardcoded reports from embedded Java code to Crystal Reports

there is a function that calculates “waitlists”

My Datamodel is as follows (I’ve left out all of the columns and tables that are not relevant)

Each table is denoted as with * and the columns are denoted with a +
their relationships are
Person table 1 to * Sessions table 1 to * Outcomes table

*Person table   
    +id - primary key


*Sessions table   
    +parentid  foreign key to Person.id
    +id   - primary key
    +isValid  
    +session-name

*Outcomes table
    +parentid  foreign key to Sessions.id
    +id -primary key
    +session-name

The logic is as follows ( i need this in sql(MSSQL preferred)):

Count the number of occurrences of each outcome that complies with the following

get a list of unique outcomes for each person
and for each of those outcomes

if there is no session with the same name as that-outcome & is valid & also has the same parent id as that-outcome’s parent session


I hope that makes sense : any help is appreciated

  • 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-24T21:12:25+00:00Added an answer on May 24, 2026 at 9:12 pm

    Something like that:

    SELECT
        p.id           AS personID
      , s.id           AS sessionID
      , s.session-name AS sessionName
      , o.id           AS outcomeID
      , o.session-name AS outcomeSessionName
    FROM Person AS p
      JOIN Sessions AS s
        ON s.parentid = p.id
      JOIN Outcomes AS o
        ON o.parentid = s.id
    WHERE NOT EXISTS
          ( SELECT *
            FROM Sessions AS s2
            WHERE s2.session-name = o.session-name
              AND s2.isValid
              AND s2.parentid = s.parentid
          )
    

    If you also want to count these outcomes, it would be more complex query. Perhaps it’s better to have another query, that counts what you want (all outcomes? per person?)

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

Sidebar

Related Questions

I have been developing some Django app and there's some duplicated code for different
I am developing some linear algebra code that that is templated on the matrix
I have been developing some code that uses Data.Array to use multidimensional arrays, now
I'm developing some lower end code in my system that uses multiple child classes
I am developing some client side Javascript that is using some JSON web services
I am developing some convenience wrappers around another software package that defines a bash
I am currently developing some user controls so that I can use them at
I am developing some JavaScript that should work with either Prototype.js or JQuery, thus
I'm developing some ajax script and using wordpress and my question is: is there
I an developing some code in which I use a scanner to get to

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.