{
"require": {
"costa-rico/yii2-images": "dev-master"
},
"repositories": [
{
"type": "git",
"url": "https://github.com/CostaRico/yii2-images.git"
},
{
"type": "composer",
"url": "https://asset-packagist.org"
}
]
}
SELECT t1.id, t2.id, t3.id
FROM my_table t1
JOIN my_table t2 ON t2.id > t1.id AND t1.distance <> t2.distance
JOIN my_table t3 ON t3.id > t2.id
WHERE ABS(t1.distance - t2.distance) = 2*ABS(t2.distance - t3.distance)
Но это только для небольших наборов данных.