• davidmckee (8/19/2014)


    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 MS SQL and not MySql

    Does anyone know how to convert this from MSSQL to MySql?

    Again assuming this is the difference....

    This was the error when I run it

    MySQL said: Documentation

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WITH

    cteWinLose AS

    ( --=== Calculates the wins/losses using a CROSS APPLY to "' at line 1

    It would appear that you need to convert the CTEs (the WITHs) to FROMs as "derived tables".

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)