user5260143
user5260143

Reputation: 1096

HQL: cast to SIGNED is not known symbol

I need to convert this query to HQL syntax:

SELECT * FROM my_table 
GROUP BY `name`
HAVING MIN(ABS(CAST(202000 AS SIGNED) -  CAST(step_id AS SIGNED))) = ABS(CAST(202000 AS 
SIGNED) -  CAST(step_id AS SIGNED));

I wrote this:

"SELECT DISTINCT t FROM myTable t GROUP BY t.name 
  HAVING MIN(ABS(CAST(202000 as signed) - CAST(t.step.id as signed))) = ABS(CAST(202000 as signed)- CAST(t.step.id as signed))"

But I get compilation error - the red line is under the keyword 'signed': "Cannot resolve symbol 'Signed'"

I don't find the way to correctly covert this query to HQL.

Upvotes: 1

Views: 23

Answers (1)

Amogh
Amogh

Reputation: 46

Can you try this? Just replace SIGNED with integer :

SELECT DISTINCT t 
FROM myTable t 
GROUP BY t.name 
HAVING MIN(ABS(CAST(202000 AS integer) - CAST(t.stepId AS integer))) = ABS(CAST(202000 AS integer) - CAST(t.stepId AS integer))

Upvotes: 2

Related Questions