jlelse's Blog

Thoughts, stories and ideas

in 💬 Micro
Share  Subscribe 

This day is successful: I created a recursive SQL CTE in SQLite even before noon. 🤓

with recursive f (i, fp, tp) as (select 1, fromPath, toPath
                                 from redirects
                                 where fromPath = ?
                                 union all
                                 select f.i + 1, r.fromPath, r.toPath
                                 from redirects as r
                                          join f on f.tp = r.fromPath)
select tp
from f
order by i desc
limit 1

This is for my new CMS project.

6 2

Jan-Lukas Else
You can also create an anonymous comment.