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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:46:36+00:00 2026-05-27T20:46:36+00:00

I have the following code, bar the possible typo should select 3 columns, the

  • 0

I have the following code, bar the possible typo should select 3 columns, the 1st being a rank, opposition and a percentage of losses.

      SELECT COUNT(B.F_FACTOR) AS RANK, A.F_OPPOSITION, A.F_FACTOR
      FROM
          (
          SELECT
          F_OPPOSITION, 
          IF(SUM(F_RESULT='L',=1,1,0) AS F_NUM,
          IF(SUM(F_RESULT IN ('W','D','L'),=1,1,0) AS F_DENOM,
          ROUND(SUM(F_NUM/F_DENOM),2) AS F_FACTOR
          FROM $table
          GROUP BY F_OPPOSITION 
          ) A,
          (
           SELECT
           F_OPPOSITION, 
           IF(SUM(F_RESULT='L',=1,=1,=0) AS F_NUM,
           IF(SUM(F_RESULT IN ('W','D','L'),=1,=1,=0) AS F_DENOM,
           ROUND(SUM(F_NUM/F_DENOM),2) AS F_FACTOR
           FROM $table
           GROUP BY F_OPPOSITION 
           ) B
     WHERE A.F_FACTOR <= B.F_FACTOR 
           OR (A.F_FACTOR=B.F_FACTOR AND A.F_OPPOSITION=B.F_OPPOSITION)
     GROUP BY A.F_OPPOSITION, F_FACTOR
     ORDER BY A.F_RANK ASC, A.F_FACTOR DESC, A.F_OPPOSITION DESC;

it is possible that i run this as a cron job to update a table nightly and then do a basic select x,y,z from that table to display this to screen with php, which i will probably do.

But in terms of learning more from a sql standpoint is their a quicker/easier, both in typing and processing, to achieve the same output.

thank you.

  • 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-27T20:46:37+00:00Added an answer on May 27, 2026 at 8:46 pm

    added cron job to update table created nightly, processing time is negligible.

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

Sidebar

Related Questions

If I have the following code: public class Foo { public void Bar() {
Imagine the following REBOL code: foo: context [bar: 3] I now have a context
I have the following piece of code: class Foo { public Foo() { Bar
friends, i have created custom title bar using following titlebar.xml file with code <?xml
Suppose I have the following Scala code: class Foo(a: Int) class Bar(b: Buffer[Int]) extends
For instance, say I have the following code. $foo = new bar(); And an
I have the following code: #$domain = domainname.co.uk #$root = public_html #$webpage = domainname.co.uk/foo/bar/foobar.html
I have the following code: namespace { void Foo() { } } namespace Bar
I have the following code: myFunc(); bar(); myFunc() is making an ajax request I
I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public

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.