Our project requries a custom sorting. And upon diving into the net I come up with the following SQL statements.
SELECT CountryName
FROM dbo.Country
ORDER BY CASE WHEN CountryName = 'INDIA' THEN '1'
WHEN CountryName = 'CHINA' THEN '2'
ELSE CountryName END ASC
Can someone help me have this in Slick?
I already have this kind of query
contriesQuery.map(_.CountryName)
.sortBy(c => {
val srt = {
Case If(x.CountryName = "India") Then 1
Case If(x.CountryName = "China") Then 2
Case Else CountryName
}
srt.asc
})
.result
But it always showing me an error org.postgresql.util.PSQLException: ERROR: for SELECT ORDER BY expressions must appear in select list
