Question : Error in an SQL query

I am trying the query below and it generated the following error, can someone please assist in resolving this?? Thanks

Error starting at line 1 in command:
Select product.prodcode, product.producttitle, productprice.retailprice, productprice.vat
from product, productprice
where product.prodcode = productprice.prodcode and productprice.prodpriceid = max(prodpriceid)
Error at Command Line:3 Column:78
Error report:
SQL Error: ORA-00934: group function is not allowed here
00934. 00000 -  "group function is not allowed here"
Code Snippet:
1:
2:
3:
Select product.prodcode, product.producttitle, productprice.retailprice, productprice.vat 
from product, productprice 
where product.prodcode = productprice.prodcode and productprice.prodpriceid = max(prodpriceid)

Answer : Error in an SQL query

Try this :

1:
2:
3:
SELECT product.*, productprice.*, productidmax.*
FROM product, productprice, (SELECT prodcode, MAX(prodpriceid) prodpriceid FROM productprice GROUP BY prodcode) productidmax
WHERE product.prodcode = productprice.prodcode AND productprice.prodpriceid = productidmax.prodpriceid AND product.prodcode = productidmax.prodcode
Random Solutions  
 
programming4us programming4us