Reputation: 1206
The execution of the following statement:
SELECT SUM(p.price)
FROM Product p
via JDBC on an embedded H2 database throws exception:
org.h2.jdbc.JdbcSQLException: Column "price" not found [42122-193]
How can I make it work?
Upvotes: 0
Views: 556
Reputation: 1206
You have to use an alias for the column used in SUM():
SELECT SUM(p.price) as price
FROM Product p
Beware! The alias has to be named exactly as the column.
Upvotes: 1