how to return multiple row from multiple table in plpgsql, I tried to return rows from 2 tables with inner join? this my code
CREATE OR REPLACE FUNCTION library.getallbookwithcategory()
RETURNS SETOF library.book AS
$BODY$
DECLARE
r library.book%rowtype;
BEGIN
FOR r IN select book.*,category.name from library.book left join library.category on category.id=book.category_id
WHERE book.id > 0 order by dateadded ASC
LOOP
-- can do some processing here
RETURN NEXT r;
END LOOP;
RETURN;
END
$BODY$
LANGUAGE plpgsql
I need return name from category