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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:15:37+00:00 2026-05-30T17:15:37+00:00

Could you help me convert this SQL statement to Linq? I have done an

  • 0

Could you help me convert this SQL statement to Linq?
I have done an IN before but the GROUP BY, ORDER BY and TOP are parts I haven’t done before.

SELECT TOP 300 lower(UserName) FROM UserHistory
WHERE LOWER(UserName) IN (SELECT Lower(UserName) FROM ActiveUsers)
GROUP BY LOWER(UserName)
ORDER BY MAX(Date) DESC
  • 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-30T17:15:38+00:00Added an answer on May 30, 2026 at 5:15 pm

    GROUP BY is done in Linq by:

    group 'result here' by 'field here'
    

    ORDER BY is done in Linq by:

    .OrderBy('lambda expression here')
    

    or

    orderby //field here  ascending | descending
    

    TOP is done in Linq by:

    .Take('number here');
    

    NOTE: the arguments are not strings, just a way to say you have to put the correct value there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this SQL statement: SELECT * FROM converts WHERE email='myemail@googlemail.com' AND status!='1' ORDER
Is there something available that could help me convert a XSD into SQL relational
Could someone help me to convert bittarray to string properly? I wrote this: static
I hope someone could help me on this. I want to add a month
I was hoping someone could help me out with this stupid problem I'm having
I have a string variable called tbSKUPrice. I need to convert this into an
Sorry I know similar question have been asked many times before but like most
can anyone help, we have a sql server 2005 database installed (actually its an
I'm new to LINQ, and (sadly) i need to convert some messed sql command
I have a set of linq to sql classes and serialized them into JSON

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.