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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:24:01+00:00 2026-06-10T00:24:01+00:00

i have some table in dataBase. INV , LIB , TRAN_TT1 datatype all field

  • 0

i have some table in dataBase. INV,LIB,TRAN_TT1 datatype all field in 3 table are string . i write this code

 var m = new MaterialModelContainer();
            var list = (from inv in m.INVs
                        where inv.NEW_QTY == "000000"
                        join lib in m.LIBs on inv.MESC equals lib.MESC
                        join tt1 in m.TRAN_TT1 on inv.MESC equals tt1.MESC4
                        where tt1.TYPE2 == "60" && tt1.QTY == "000000" 
                       select new
                                   {
                                       inv.MESC,
                                       lib.LINE_NO,
                                       lib.UNIT_LINE,
                                       Description = lib.DES + " " + lib.PART_NO,

                                   }).ToList();

table TRAN_TT1 has a ACTD field, i want get max value
i write this code

 var m = new MaterialModelContainer();
            var list = (from inv in m.INVs
                        where inv.NEW_QTY == "000000"
                        join lib in m.LIBs on inv.MESC equals lib.MESC
                        join tt1 in m.TRAN_TT1 on inv.MESC equals tt1.MESC4
                        where tt1.TYPE2 == "60" && tt1.QTY == "000000" 
                       select new
                                   {
                                       inv.MESC,
                                       lib.LINE_NO,
                                       lib.UNIT_LINE,
                                       Description = lib.DES + " " + lib.PART_NO,
                                     ACTD=  tt1.ACTD.Max()
                                   }).ToList();

but no work,

please help me to get max ACTD field . thanks all

  • 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-10T00:24:02+00:00Added an answer on June 10, 2026 at 12:24 am

    Max is a aggregate function, and the aggregate functions in Linq has the same restrictions like in SQL – if you use aggregate function for one of the column – all other using columns should be also used in aggregate functions or you should use GroupBy by them.
    So your sample should be something like:

    var m = new MaterialModelContainer();
                var list = (from x in 
    
                           (from inv in m.INVs
                            where inv.NEW_QTY == "000000"
                            join lib in m.LIBs on inv.MESC equals lib.MESC
                            join tt1 in m.TRAN_TT1 on inv.MESC equals tt1.MESC4
                            where tt1.TYPE2 == "60" && tt1.QTY == "000000" 
                            select new {inv.MESC, lib.LINE_NO, lib.UNIT_LINE, Description = lib.DES + " " + lib.PART_NO, tt1.ACTD})
    
                            group by new {x.MESC, x.LINE_NO, x.UNIT_LINE, x.Description} into g
                            select new {g.Key.MESC, g.Key.LINE_NO, g.Key.UNIT_LINE, g.Key.Description, ACTDMax = g.Max(tt2 => tt2.ACTD) } );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have some fields in my database table,and a field with phone name ,
I have some code to update a database table that looks like try {
I have a database table with some rows that I want to fetch using
I have to add some enum options to a database table. The problem being,
I have a table in database that is having some fields one of which
I have a table within my database that has many records, some records share
We have this current database which we need to replace some tables by anther
I have some table and records in a database, that I use to manually
Hi everyone i have one question i.e. i have some database table's which are
I have some database table and need to process records from it 5 at

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.