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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:29:35+00:00 2026-05-25T17:29:35+00:00

Okay, two admissions here, one is I’m sure this question has been answered and

  • 0

Okay, two admissions here, one is I’m sure this question has been answered and it has something to do with a join and the second is I’m not sure why I’m writing an application which requires complex SQL when I don’t really know SQL.

Here’s the problem, most likely it’s cake walk, but I can’t seem to find the answer on here;

I have a select which returns an ID and a sum of items from a table. I want to take the ID and resolve this as the actual name.

Here’s the query;

select top 10 
    sum(elapsedTimeSeconds) as et, AppID 
from UsersAppLog 
where userid = 1 
  and appid <> 7 
  and CreatedOn > '01 Sep 2011' 
group by 
    AppID 
order by 
    et desc

so I get;

et, appid

and I want to lookup “description” from the windowsapps table based on the returned appid.

Any help would be appreciated.

Phil.

  • 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-25T17:29:35+00:00Added an answer on May 25, 2026 at 5:29 pm

    Just add the column you need to the query and the GROUP BY clause:

    SELECT TOP 10 
        SUM(u.elapsedTimeSeconds) AS et, u.AppID, wa.Description
    FROM dbo.UsersAppLog u
    INNER JOIN dbo.WindowsApps wa ON u.AppID = wa.AppID
    WHERE
        u.userid = 1 
        AND u.appid <> 7 
        AND u.CreatedOn > '20110901'     -- use ISO-8601 format for extra safety!
    GROUP BY 
        u.AppID, wa.Description 
    ORDER BY
        et DESC
    

    Not knowing your exact schema (it would help for the future to post those things!), I’ve guessed that you have an AppID in the WindowsApplications table, too – and I’ve assumed all your u.AppID will have a proper match – therefore the INNER JOIN

    I would also recommend to always use the ISO-8601 date format (YYYYMMDD) – it’s the only way to make sure your code will work regardless of the locale/regional/language setting on the SQL Server machine in question.

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

Sidebar

Related Questions

Okay, when my app starts it has two tabs, and one action in the
Okay i have two models: posts and comments. as you can think comments has
Okay, I have two OperationContracts and MessageContracts, like this: [OperationContract] OperationResult OperationOnSingleItem(Input input) [OperationContract]
Okay this question is very simple: I have a facebook page, and a website.
Okay so what I have right now is two arrays with data. myArray1 has
Okay so here's my problem. I have a two global NSString variables. globalVariable1 //stores
Okay so this is sort of a double question so I'll split it into
Okay, here is my problem: I have a form that requires to have two
Okay so part two on this. I restructured the code on this but now
okay im making a layout that has two sides. the left is 30% and

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.