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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:10:05+00:00 2026-06-17T17:10:05+00:00

I’ve got a table called IssueStatuses and another table called Issues. Issues has a

  • 0

I’ve got a table called IssueStatuses and another table called Issues. Issues has a StatusID and SubStatusID, both of which are from the IssueStatuses table which has an additional field that states if it’s a SubStatus or not, like so:

IssueStatuses

  • IssueStatusID
  • IssueStatus
  • IsSubStatus

I’m trying to get a list of SubStatuses for a particular list of Issues. In SQL it’s:

SELECT iss.IssueStatus, COUNT(iss.IssueStatus) AS Total
FROM Issues AS Issues 
INNER JOIN Rooms r ON Issues.RoomID = r.RoomID 
INNER JOIN Locations l ON l.LocationID = r.LocationID 
INNER JOIN Customers c ON l.CustomerID = c.CustomerID 
INNER JOIN (SELECT * FROM IssueStatuses WHERE IsSubStatus = 0) ist ON Issues.IssueStatusID = ist.IssueStatusID 
INNER JOIN (SELECT * FROM IssueStatuses WHERE IsSubStatus = 1) iss ON Issues.IssueSubStatusID = iss.IssueStatusID 
WHERE c.Customer = 'ABC' 
AND l.Location = 'MySite'
GROUP BY iss.IssueStatus

but I”m having trouble converting it to LINQ. The desired output would be something like:

IssueStatus | Total
-------------------
Open          15
Delayed       25
On Time       8 

Here’s what I’ve tried with LINQ:

var query = from i in Issues
join r in Rooms on i.RoomID equals r.RoomID
join l in Locations on r.RoomID equals l.LocationID
join c in Customers on l.CustomerID equals c.CustomerID
where i.IssueStatusID == (from ist in IssueStatuses
                            where ist.IsSubStatus == false
                            select ist)
&& i.IssueSubStatusID == (from iss in IssueStatuses
                            where iss.IsSubStatus == true
                            select iss)
&& c.Custome == "ABC"
&& l.Location == "MySite"
    group i by i.IssueStatus

but I know it’s wrong because LINQPad throws an error stating:

can't convert int to type Models.IssueStatus

What I need to do is use iss.IssueStaus to group on but I can’t access it. Can someone tell me what I’m doing wrong?

  • 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-06-17T17:10:06+00:00Added an answer on June 17, 2026 at 5:10 pm

    How about this (untested but I should be close):

    var query = from i in Issues
                join r in Rooms on i.RoomID equals r.RoomID
                join l in Locations on r.LocationID equals l.LocationID
                join c in Customers on l.CustomerID equals c.CustomerID
                join ist in IssueStatuses on i.IssueStatusID equals ist.IssueStatusID
                join iss in IssueStatuses on i.IssueSubStatusID equals iss.IssueStatusID
                where !ist.IsSubStatus && iss.IsSubStatus
                    && c.Customer == "ABC"
                    && l.Location == "MySite"
                group i by iss.IssueStatus into g
                select new {IssueStatus = g.Key, Total = g.Count()}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have an array which has BIG numbers and small numbers in it. I
I have a text area in my form which accepts all possible characters from
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am confused How to use looping for Json response Array in another Array.
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is

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.