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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:50:51+00:00 2026-05-28T17:50:51+00:00

My question is identical to two previously asked questions LINQ TO DataSet: Multiple group

  • 0

My question is identical to two previously asked questions

LINQ TO DataSet: Multiple group by on a data table, the only difference with this question is that I need to do that with Method Syntax.
and

LINQ Group By Multiple fields -Syntax help – the difference with this question is that I need to do this using LINQ-to-DataSet.

I’m trying to group the Customers by Country, with the result (expected) as below:

   COUNTRYCODE     CUSTOMERNAME
   USA             Microsoft   
   USA             IBM
   CAN             RIM
   CAN             Tim Horton
   GER             BMW

How do we do this? Thank you.

EDIT:

Here’s the messy code I’m struggling with.

   var query = orders.AsEnumerable()
                    .GroupBy(t => new {CountryCode= t.Field<string>("CountryCode"), 
                                       CustomerName = t.Field<string>("CustomerName"), 
                                    (key, group)=> new {Key1 = key.CountryCode, Key2=key.CustomerName})
                    .Select(t => new {t.Key1, t.Key2});
  • 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-28T17:50:51+00:00Added an answer on May 28, 2026 at 5:50 pm

    The code in my EDIT worked:

     var query = orders.AsEnumerable()   
                  .GroupBy(t => new {CountryCode= t.Field<string>("CountryCode"),
                                     CustomerName=t.Field<string>("CustomerName"),
                               (key, group)=> new {CountryCode = key.CountryCode,CustomerName=key.CustomerName})
    .Select(t => new {t.CountryCode, t.CustomerName}); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I asked the question this way because I can imagine that there's a potentially
This is a follow-on from a previous question, in the implementation, I have two
This is a tough question to word...so bear with me. I have two tables
this is really two questions, I'll start with the easiest. I get an access
This is similar to another question I've asked, but, I've created an expression class
I noticed that this answer to a question about .Rprofile settings mentions setting two
An easy jQuery question. I have several identical forms ( except their name )
Like my question, i need to generate random numbers that have identical pairs between
Please help me in finding the optimized solutions to these interesting data structure questions:
This is a basic question about what options are available for defining the scope

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.