Thank you, I didn't know about generated columns, sounds nice, but unfortunately this is a widely distributed web-app and the currently required version of SQLite is only 3.16, and I can't use any extension either. I knew about the eval() extension but can't use it here. I will just do an extra loop in the app code itself then. Thanks everyone for your help :)