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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:19:00+00:00 2026-06-06T15:19:00+00:00

id’like to count how many documents a User edited or created. Therefore I have

  • 0

id’like to count how many documents a User edited or created. Therefore I have a Datatable which contains the information sth. like this:

Input
DocumentName | ModifiedBy | CreatedBy
 a              Frank         Frank
 b              Mike          Frank
 c              John          Mike

That should be the Output:

Name   DocumentsModified(Total)  DocumentsCreated(Total)
Frank      1                        2
Mike       1                        1
John       1                        0

So what it did to count all documents a person edited, is the following

var query = from queryResult in resultTable.AsEnumerable()
group queryResult by queryResult.Field<string>("ModifiedBy") into rowGroup
select new 
{
    Name = rowGroup.Key, ModifiedDocuments = rowGroup.Count()
};

This works fine. Now i have to count also the values of the column “Creator”. Is this possible and if so, how would i do that? OK, i could iterate over the table, but it would be nice to accomplish this in the LinQ query.

I tried to use “group queryResult by new {}” but i’m not sure if i’m on the right track.

  • 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-06T15:19:02+00:00Added an answer on June 6, 2026 at 3:19 pm

    You’re best bet would be to just query for created and modified separately and then combine the results with a join.

    var modifiedCount = from queryResult in resultTable.AsEnumerable()
    group queryResult by queryResult.Field<string>("ModifiedBy") into rowGroup
    select new 
    {
        Name = rowGroup.Key, ModifiedDocuments = rowGroup.Count()
    };
    
    var createdCount = from queryResult in resultTable.AsEnumerable()
    group queryResult by queryResult.Field<string>("CreatedBy") into rowGroup
    select new 
    {
        Name = rowGroup.Key, CreatedDocuments = rowGroup.Count()
    };
    
    var finalResult = from first in modifiedCount 
                      join second in createdCount
                      on first.Name equal second.Name
                      select new 
                      {
                         first.Name,
                         first.ModifiedDocuments,
                         second.CreatedDocuments 
                      };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
I would like to run a str_replace or preg_replace which looks for certain words
I have a text area in my form which accepts all possible characters from
I have a reasonable size flat file database of text documents mostly saved in
I am trying to loop through a bunch of documents I have to put
I have some data like this: 1 2 3 4 5 9 2 6
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small

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.