This question already has an answer here:
When an attacker reduces a creature to 0 hit points with a melee attack, the attacker can knock the creature out. The attacker can make this choice the instant the damage is dealt. The creature falls unconscious and is stable.
Is there a way other than a melee attack to achieve the same result? A spell or a ranged attack, maybe a feature or ability of a class I'm not aware of? Or is it simply impossible with RAW?