So i have this query to fetch all posts
select id, title
from posts
where type = 'article'
and i have a stored function that calculate the total of views and return the result
i know i can execute it like
select totalView(id)
but how can i merge the two queries to return all posts with the total view of each post
maybe something like
select id, title, totalView(id) as total
from posts
where type = 'article'
Thank you.