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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:43:58+00:00 2026-05-21T04:43:58+00:00

Hi I usually hunt the net and sleep on things until I find the

  • 0

Hi I usually hunt the net and sleep on things until I find the answer but the following seemingly simple problem is completely evading me.

I have 2 tables,

TBL_Incidents

IncidentID
IncidentDate
IncidentReportedBy
IncidentDescription

and TBL_Comments

CommentID
CommentFromUser
Comment

There are multiple comments per incident.

I’d like to get all information from TBL_Incidents where any of the incident’s comments come from a particular user.

All the joins I’ve tried duplicate the incidents, including the left join that I was sure would have worked, e.g.

IncidentID | IncidentDate (+ all other TBL_Incident fields) | CommentID
4 | ... | 2
4 | ... | 3
4 | ... | 5
9 | ... | 12
9 | ... | 13

It’s like I want to use a group by on the Incident ID, but then it won’t give me the rest of the info from TBL_Incidents because they’re not in the group by clause.

a) does anyone have any idea what I’m babbling on about?

b) does anyone know whether it’s possible?

Many 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-21T04:43:59+00:00Added an answer on May 21, 2026 at 4:43 am

    I don’t see where Incidents and Comments are related. Is there an IncidentID in TBL_Comments? If so, then you would join on IncidentID and filter on CommentFromUser like so:

    SELECT *
    FROM TBL_Incidents JOIN TBL_Comments ON TBL_Incidents.IncidentID = TBL_Comments.IncidentID
    WHERE TBL_Comments.CommentFromUser = UserID
    

    If there is no IncidentID in TBL_Comments then there is not enough information available to link them together…

    Minor reading comprehension fail edit:

    Assuming you’ve got the ID and you’re just combatting duplicates, slap a DISTINCT on there:

    SELECT DISTINCT TBL_Incidents.*
        FROM TBL_Incidents JOIN TBL_Comments ON TBL_Incidents.IncidentID = TBL_Comments.IncidentID
        WHERE TBL_Comments.CommentFromUser = UserID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Usually I worked with PostgreSQL and never had a problem, but now I need
Usually when I need to find the max value of an array I use
Usually wordpress structure for category is as below. http://ourdomain/category/categoryname/subcategoryname but I want my structure
Usually I would expect a String.contains() method, but there doesn't seem to be one.
Usually, I've seen it with forms, but I've found it helpful to group related
Usually both files are availble for running some diff tool but I need to
Usually i am pretty good at working my way round as3 but this one
usually , we use http get method to do a spellcheck query, but now
Usually I develop in Java but now I need to write an app that
Usually, when you browse mobile website on iPhone it displays correctly. But when I

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.