First view to sql function.

It does not handle virtual tags yet.
And code is ugly!
Add virtual tags $all and $pubDate in views

But SQL query is bad. I must redesign it.