Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

SQL Syntax

  • 02-11-2003 1:12pm
    #1
    Registered Users, Registered Users 2 Posts: 2,281 ✭✭✭


    Hi there,

    I am trying to do the following in mysql
    var = MAX (var, othervar);
    
    or  another way:
    
    var = (othervar > var) ? othervar : var;
    
    

    So far i have my statement like this:
    $query = "UPDATE players SET best_streak=MAX(current_streak, best_streak) WHERE user_id=$winner LIMIT 1";
    


    That is not how MAX is used in mysql, i know that.

    Does anyone know how to do it?


Comments

  • Registered Users, Registered Users 2 Posts: 2,281 ✭✭✭DeadBankClerk


    Got it sorted with GREATEST () thanks to ecksor!


  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    For future reference, and even more flexibility, the CASE statement should be worth getting to know.

    jc


Advertisement