davidyell / FFBE-Helper

An application for managing units and parties for Final Fantasy Brave Exvius

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Closest to max

davidyell opened this issue · comments

A nice feature might be showing which units are closest to being maxed, as a percentage of their current level.

It might need to display both, closest to maximum rarity and level, as well as unit closest to awakening.

SELECT 
acquires.id, 
units.name,
acquires.unit_id, 
acquires.level, 
rarities.max_level,
rarities.stars,
(rarities.max_level - acquires.level) AS levels_remaining
FROM acquires
JOIN units ON units.id = acquires.unit_id
JOIN rarities ON rarities.id = acquires.rarity_id
WHERE acquires.user_id = 1
HAVING levels_remaining > 0 AND levels_remaining < 20
ORDER BY `levels_remaining` ASC