grails - How to order by number of keywords found in sql/namedQuery -


i created query , or

select * xxx title ('%bon%') or title ('%test%') 

i receive result : bonjour je test bonjour test bonjour test

and ordered number of word in title : bonjour je test test bonjour bonjour test

i use grails namedqueries.

is possible ?

thanks

you can use little trick count number of space characters , sort that.

select * xxx title ('%bon%') or title ('%test%') order (len(title) - len(replace(title, ' ', ''))) 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -