I have the field "killed" and "died" in the table, I need to make the order of the results come according to the decrease of these two values,
My query looks like this:
$woes = DB::table('woeplayerrank as woe')
->join('char', 'woe.char_id', '=', 'char.char_id')
->select('woe.kills_permanente', 'woe.deaths_permanente', 'woe.killen_spree', 'woe.name', 'char.unban_time', 'char.class')
->orderBy('woe.kills_permanente', 'ansi')
->take('100');
I'd like it to be something around this:
$woes = DB::table('woeplayerrank as woe')
->join('char', 'woe.char_id', '=', 'char.char_id')
->select('woe.kills_permanente', 'woe.deaths_permanente', 'woe.killen_spree', 'woe.name', 'char.unban_time', 'char.class')
->orderByRaw('woe.kills_permanente - woe.deaths_permanente ansi)
->take('100');
Does anyone know how to do this?