Please help me to write HQL query for the following SQL query:
SELECT MAX(CAST(SUBSTRING([columnname], 6) AS UNSIGNED))+1
FROM [Tablename]
WHERE DistrCode = [(value)];
Please help me to write HQL query for the following SQL query:
SELECT MAX(CAST(SUBSTRING([columnname], 6) AS UNSIGNED))+1
FROM [Tablename]
WHERE DistrCode = [(value)];
I cannot try it myself, but just from searching around I found these probable solutions:
Solution 1
SELECT MAX(CAST(SUBSTRING([columnname], 6) AS UNSIGNED INTEGER))+1
Solution 2
SELECT MAX(CAST(SUBSTRING([columnname], 6) AS INTEGER))+1
Maybe you can try both and report back, which one worked.