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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:21:09+00:00 2026-05-25T14:21:09+00:00

What will be the equivalent of following SQL statement in Linq? I’m specifically looking

  • 0

What will be the equivalent of following SQL statement in Linq? I’m specifically looking on how to replace CASE statements in Linq expression.

SELECT a.app_id   AS Id, 
   a.app_nm   AS [Name], 
   COUNT(CASE 
           WHEN l.level_nm = 'ERROR' THEN l.log_id 
           ELSE NULL 
         END) AS Error, 
   COUNT(CASE 
           WHEN l.level_nm = 'FATAL' THEN l.log_id 
           ELSE NULL 
         END) AS Fatal 
FROM   info_log l 
     INNER JOIN application_info a 
     ON a.app_id = l.app_id 
WHERE  l.level_nm IN ( 'ERROR', 'FATAL' ) 
GROUP  BY a.app_id, 
          a.app_nm 
  • 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-25T14:21:10+00:00Added an answer on May 25, 2026 at 2:21 pm

    This should help you out

    var query = from l in context.info_log
                from a in context.application_info
                where l.app_id == a.app_id
                where l.level_nm == "ERROR" || l.level_nm == "FATAL"
                group l by new { a.app_id, a.app_nm } into lg
                select new
                {
                  Id = lg.Key.app_id,
                  Name = lg.Key.app_nm,
                  Error = lg.Where(x => x.level_nm == "ERROR").Count(),
                  Fatal = lg.Where(x => x.level_nm == "FATAL").Count(),
                };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What will be the equivalent find statement of the following below ? @mostviews =
I'm looking for the equivalent in Qt to GetTickCount() Something that will allow me
I'm looking for the equivalent of the Unix 'tail' command that will allow me
I want to perform an SQL query that is logically equivalent to the following:
I'm wondering if the following SQL update query is possible using the equivalent SubSonic
What will be the dojo equivalent code of following.? var msgContainer = document.createElement('div'); msgContainer.id
Does anyone know the Telerik/radgrid equivalent of the following statement? e.InputParameters[id] = Convert.ToString(myRadgrid.DataKeys[myradgrid.SelectedIndex].Value); I'm
Are the following Lambda and Linq expressions equivalent in terms of execution paths? I
The challenge The shortest code by character count that will output the numeric equivalent
I've got the following T-SQL code below that's working from inside of SQL Server

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.