I have a query where I use COUNT to calculate the volume of sales of a seller for me a month Should require average sales from this vendor. This is divided by the number of COUNT days only. The problem is that COUNT gives an integer and if I divide it in greater numbers, then it returns zero only, so I thought about using it:
CAST (COUNT as the float) / x The problem is that X is the number of days the problem is that I use CAST on a named query can not do. Is there any other way to do this, so I do not have to use CAST?
If you are using the createSQLQuery () method, it automatically without any casting / conversion Convert the result to the decimal number.
list l1 = ss.createSQLQuery (select "double to 1/100"). List (); //0.0100 But if this is the createQuery () method, you can convert it by casting big_decimal
list l2 = ss.create ("SELECT cast (1/100 big_desim), your maped column from your maptable"). List (); //0.01
No comments:
Post a Comment