How can I make this query works?
I've the function top_movies_ceiling(3)
CREATE OR REPLACE FUNCTION top_movies_ceiling(n_top integer) -- n_top dos mais vendidos
RETURNS SETOF inventory AS $$
BEGIN
RETURN QUERY
SELECT *
FROM inventory
ORDER BY sales DESC
LIMIT n_top;
END;
$$LANGUAGE plpgsql;
that returns:
prod_id|quan_in_stock|sales
Now, when I run the query:
SELECT products.price
FROM products
WHERE products.prod_id = prod_id.top_movies_ceiling(3);
I get the error: schema "prod_id" does not exist
I hope that you can help me! Thanks!
prod_id.top_movies_ceilin?..