Stat Relation Without Foreign Key

Hello!

I use for my project nested set model, that has attributes ltf, rgt and level.

How can I define STAT relation for get count of child items of model.

Example:

name/lft/rgt/level

phone/1/6/1

nokia/2/3/2

samsung/4/5/2

auto/7/12/1

toyota/8/9/2

bmw/10/11/2

For ‘phone’ there are query “SELECT COUNT(*) FROM t WHERE lft>1 AND rgt<6”

For ‘auto’ there are query “SELECT COUNT(*) FORM t WHERE lft>7 AND rgt<12”