Forum Replies Created

Viewing 11 posts - 1 through 11 (of 11 total)

  • RE: Convert Excel formula to SQL<!-- 864 -->

    I did not change the code for the WinLossSum. Thanks again!

    CREATE VIEW WinLossSum AS

    SELECT Team, SUM(Result) Wins, SUM(Result^1) Losses

    FROM WinLoss

    GROUP BY Team

    Results

    TEAM......WINS......LOSSES

    ..A............ 6..............0...

    ..B............6..............0....

    ..C............ 4..............2...

    ..D............ 3..............2...

    ..E...............

  • RE: Convert Excel formula to SQL<!-- 864 -->

    Here you go!

    Final MySQL:

    SELECT Team, Wins, Losses, CAST(IF(Wins + Losses = 0,0.0,Wins / CAST(Wins + Losses AS Decimal(6,3))) AS Decimal(6,3)) Percentage, ((ABS((SELECT MAX(Wins ) FROM WinLossSum) - Wins )) +...

  • RE: Convert Excel formula to SQL<!-- 864 -->

    Actually I got it!!!

    I adjusted the SQLfiddle statement needed a couple extra brackets to complete the addition before dividing by 2:

    This now works!!!

    ((ABS((SELECT MAX(Wins ) FROM WinLossSum) - Wins ))...

  • RE: Convert Excel formula to SQL<!-- 864 -->

    This is very close but something else is slightly off...the third place team should be 2 games behind not 3

    This was the SQLfiddle statement:

    (ABS((SELECT MAX(Wins ) FROM WinLossSum) -...

  • RE: Convert Excel formula to SQL

    This is the exact result...except it seems to be in MSSql...the web server runs MySql

    I did some research after copying the code into the query and receiving errors...maybe this is...

  • RE: Convert Excel formula to SQL

    I connect to the server/table using phpMyAdmin I believe it is a MySQL database

    The menu gives me the following options...

    Browse

    Structure

    SQL

    Search

    Insert

    Export

    Import

    Operations

    Triggers

    Thanks in advance if you have time later

    Cheers,

    David

  • RE: Convert Excel formula to SQL

    I appreciate all your help...there are no Ties (only wins and loses)

    Sorry this may be a terrible question but how do I add the fields to make them calculate? When...

  • RE: Convert Excel formula to SQL

    I was looking at the SQL...question how do winner/loser to the sql table so when the score is entered it updates the Winner/Loser column? Or is there a better way?

    I...

  • RE: Convert Excel formula to SQL

    I have attached the excel file.

    The standings is not a true table...it looks to the "games" table and the standings are all calculated and sorted.

    So I have created the table...

  • RE: Convert Excel formula to SQL

    I have attached the excel file.

    The standings is not a true table...it looks to the "games" table and the standings are all calculated and sorted.

    So I have created the table...

  • RE: Help SQL question (Calculation)

    1. You seem to be working on something different to SQL Server. I had to translate the code to test the code. (I am sql from phpMyAdmin a web database)

    Let's...

Viewing 11 posts - 1 through 11 (of 11 total)