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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:43:29+00:00 2026-05-12T06:43:29+00:00

I have sql as below SELECT Q.MaterialID AS MaterialID, Q.ProductID AS ProductID, QB.Quantity AS

  • 0

I have sql as below

SELECT Q.MaterialID AS MaterialID, Q.ProductID AS ProductID, QB.Quantity AS Quantity, 
        Q.ParameterID AS ParameterID, SUM((Q.ParameterValue * Q.Quantity)/Q.TotalTonnes) AS ParameterValue
    FROM @Quality Q
    INNER JOIN @QuantityBreakdown QB 
    ON ((Q.MaterialID = QB.MaterialID) OR (Q.MaterialID IS NULL AND QB.MaterialID IS NULL))
    AND ((Q.ProductID = QB.ProductID) OR (Q.ProductID IS NULL AND QB.ProductID IS NULL))
    GROUP BY Q.MaterialID, Q.ProductID, ParameterID, QB.Quantity

conversion to LINQ….. struck at ???

var enumerable = from final in (from q in qualities
                                        from qb in quantityBreakDowns
                                        where q.ProductID == qb.ProductID && q.MaterialID == qb.MaterialID
                                        select new
                                                   {
                                                       q.MaterialID,
                                                       q.ProductID,
                                                       q.ParameterID,
                                                       qb.Quantity,
                                                       ParameterValue = ((q.ProductID*q.Quantity)/q.TotalTonnes)
                                                   }
                                       )
                         group final by new
                                            {
                                                final.MaterialID,
                                                final.ProductID,
                                                final.ParameterID,
                                                ???
                                            }
                         into finalresult select finalresult;

Is there some other good way to do this.

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-12T06:43:30+00:00Added an answer on May 12, 2026 at 6:43 am

    Ok solved this as:

    from final in
                                 (from q in qualities
                                  from qb in quantityBreakDowns
                                  where q.ProductID == qb.ProductID && q.MaterialID == qb.MaterialID
                                  select new
                                             {
                                                 q.MaterialID,
                                                 q.ProductID,
                                                 q.ParameterID,
                                                 qb.Quantity,
                                                 ParameterValue = ((q.ActualValue*q.Quantity)/q.TotalTonnes)
                                             }
                                 )
                             group final by new
                                                {
                                                    final.MaterialID,
                                                    final.ProductID,
                                                    final.ParameterID,
                                                    final.Quantity
                                                }
                             into finalresult
                                 select new
                                            {
                                                finalresult.Key.MaterialID,
                                                finalresult.Key.ProductID,
                                                finalresult.Key.ParameterID,
                                                finalresult.Key.Quantity,
                                                ActualValue = finalresult.Sum(fq => fq.ParameterValue)
                                            };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the code below: string SQL = select * from + TableName; using
I have a T-SQL that works below: SELECT WP_VTDID AS UTIL_VTDID, (SELECT COUNT(WP_ENGINE) FROM
I have a sql search like below: select distinct user_id from wp_usermeta where (
I have below SQL query: SELECT * FROM ( SELECT S.aCol, S.bCol, S.cCol, ROW_NUMBER()
I have a sql select like below: select * from table1 where text in
I have an SQL query (below) that essentially takes a student from tbStudents, and
I have the below sql query to insert the records from a table. The
I have the SQL query: SELECT ISNULL(t.column1, t.column2) as [result] FROM t I need
I have issued the SQL statement below : SELECT GATNR ,GITNO ,GBANO ,MAX (CASE
I have a SQL Query as below: SELECT urban_appr, urban_in, rural_appr, rural_in, ground_appr, ground_in

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.