خرید بک لینک

Vote count: 0

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

asked 43 secs ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 14 تير 1395 ساعت: 17:37

صفحه بندی