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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:04:14+00:00 2026-06-14T02:04:14+00:00

I have an data table I wish to perform some numeric analysis on for

  • 0

I have an data table I wish to perform some numeric analysis on for that I need all the values to be in the same range. 0..1.

I have a somewhat slow and longhanded way of accomplishing this but would like a more straigt forward performant solution to my problem

What I need to do is:

group by projectid
with in each project take the average of each of the values and divide by the largest average for the entire set.

currently I have

select avg(foo * 1.0)/ (Select MAX(IL) FROM (select avg(foo * 1.0) as IL from table group by     
                                             ProjectID) tbl)
from table

so if the list is

projectid  | foo
-----------------
1          | 1
1          | 2
2          | 4
2          | 2

the largest average is 3 and the result should therefor be

0.5,1

where the first is the average for projectId 1 divided by 3 and the second is the average for projectId 2 divided by 3

  • 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-14T02:04:16+00:00Added an answer on June 14, 2026 at 2:04 am

    SQL FIDDLE EXAMPLE

    select
        Projectid,
        avg(cast(foo as decimal(29, 2))) / max(avg(cast(foo as decimal(29, 2)))) over ()
    from tbl1
    group by Projectid
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data table which already has some values, plus it is getting
I have the data table from the jquery plugin dataTables (http://datatables.net/) that I want
I have a single table for which I wish to find all the instances
I need advise wish scenario is most efficient to represent my data Table (A)
So I have a table with a field that I wish to work with
I have a list of objects that contain row data for a table. There
I have a rather large (many gigabytes) table of data in SQL Server that
I have a situation, I wish to have 3 word in 1 table data.
I have data table containing one column as FilePath. FilePath D:\New folder\link.txt D:\New folder\SharepointMigration(Work
I have a data.table object like this one library(data.table) a <- structure(list(PERMNO = c(10006L,

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.