Equivalent to LEFT() sql function in JPA

Asked

Viewed 75 times

0

What is the LEFT() equivalent function in JPA?

I need to take only the first 6 characters of a field.

The equivalent select in sql would be:

select  left(campo,6), count(*) qtd
from tabela
group by left(campo,6)

1 answer

0


No LEFT() function in jpa!

The documentation restricts the capture of string portions only to the [function] SUBSTRING().

ex:

select substring(v.campo, 1, 6), count(*)
from V v
group by substring(v.campo, 1, 6)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.