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

The Archive Base Latest Questions

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

I am doing a formula to make some statistics in SQL, but I do

  • 0

I am doing a formula to make some statistics in SQL, but I do not know how to improve a query I am working on…

I made a sqlfiddle so you can understand me better

So I have 3 tables and I need to solve a formula varying the indexes, i,j…

i j
---
1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
3 3

and then do some sqrt and pow. I want the result in a table but I do not know how to generalize all those long queries into one…

  • 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-14T10:36:05+00:00Added an answer on June 14, 2026 at 10:36 am

    This appears to just need a couple of CROSS JOINs:

    SELECT  ((N.n*M1.m)-(S1.s*S2.s)) / 
                   (SQRT((N.n*M2.m)-(pow(S1.s,2))) * SQRT((N.n*M3.m)-(pow(S2.s,2))))
    FROM N
    CROSS JOIN sums as S1
    CROSS JOIN sums as S2
    JOIN mults as M1
         ON M1.i = S1.i
         AND M1.j = S2.i
    JOIN mults as M2
         ON M2.i = S1.i
         AND M2.j = S1.i
    JOIN mults as M3
         ON M3.i = S2.i
         AND M3.j = S2.i;
    

    (I’ve modified the Fiddle to include this. Thanks for providing one!).

    However, your overall design is a little suspicious to me; what exactly are you attempting to accomplish?

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

Sidebar

Related Questions

I know there's an easy way of doing this, but my recursion abilities are
I've been doing BigO recently, and I get the formula ok, but I've written
I'm doing some math with really big numbers (I'm using Python, but this question
I'd like to make a linear score formula that I can use in a
I'm graphing some statistics which can be percentages, currency values or plain numbers. I
The query I am doing is: Cursor cursor = managedQuery(Formula.CONTENT_URI, new String[] { Formula._ID,
Doing some jquery animation. I have certain divs set up with an attribute of
Doing some homework here (second assignment, still extremely green...). The object is to read
Doing a mysqli query and COUNTing the results, is there a preferred comparison operator
Doing a simple Squeryl database lookup, but trying to exclude a value. I've tried:

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.