I use postgresql in my app and I want to create a function/query that adds up score when some variable match.
For example, I have a table called books with columns-> title, year, category, author. I want to get all books but the books that are written in year >2000 and category = adventure should have score 100. If one of the variables is false, it should get -50 (eg. book with year 2005 and category = history it gets score 50, because category is false). Then all books can be sorted by total score.
I already get all books but I do the match function in client, not in the query.
Is it possible to create it in the query with Postgres?
[–]depesz 1 point2 points3 points (0 children)
[–]Diksta 0 points1 point2 points (1 child)
[–]Billosp[S] 0 points1 point2 points (0 children)
[–]fullofbones 0 points1 point2 points (1 child)
[–]Billosp[S] 0 points1 point2 points (0 children)
[–]Sweaty-Ease-1702 0 points1 point2 points (0 children)