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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:08:21+00:00 2026-05-23T13:08:21+00:00

i have a db diagram as shown above. What I need to do is:

  • 0

dbdiagram

i have a db diagram as shown above.
What I need to do is:
Select a table which is as follows:
PatientId, Emergency.Name or Doctor Names, Patient.Address.

Explanation; I need A query which will return patient details and, if Patient has an emergency also add an emergency, if not select all doctor.Name into one row.

So, example:
Example

So, the first row was built because EmergencyId in table patient was null, while the second row had an emergency Id.

I need the query to simulate this. Using SSRS

Thanks a lot!

  • 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-23T13:08:21+00:00Added an answer on May 23, 2026 at 1:08 pm

    Thanks guys, can you at least explain
    me how to return this data in separate
    rows, so I can union later on?

    I believe this will return the data you want broken out into separate rows, returning Emergency if it exists and the Drs if it does not. Good luck!

    SELECT Distinct Coalesce(E.Name, D.Name) as VariableColumn, 
           P.PatientId,           
           P.Address
    FROM Patient P 
      LEFT JOIN Emergency E 
        ON P.EmergencyId=E.EmergencyId
      LEFT JOIN PatientDoctor PD 
        ON P.PatientID=PD.PatientId
      LEFT JOIN Doctor D 
        ON PD.DoctorId=D.DoctorId
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an disjoint ER diagram in which my table Employee is disjoint to
I have two tables as shown in the following diagram : as you saw
I have a table in my LINQ2SQL diagram with a column called DayOfWeek in
I have a set of Django models as shown in the following diagram (the
I have a class diagram for my application which consists of several compositions and
I have 3 tables as shown in the diagram: The test data in each
I have a website whose layout has been shown in the diagram. The body
I have a relatively simple domain model, as shown by the diagram. I would
As shown from the diagram above, I only want to allow users to drag
i need some help with this problem. I have a binary tree stucture which

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.