I am trying to learn how to create functions in PostgreSQL and I am quite stumped.
I understand the concept, to build an SQL function so that the DB doesn't have to think about that call each time the page requests it. What I do not understand is how to apply all the complexities of an SQL call into the function.
What I am trying to do is make the following call faster:
SELECT p.id, p.prop_name, p.book_active, p.addr, p.city, p.prov, p.country, p.pcode, p.active, l.location, d.id AS direction_id, d.directions, d.map_link, d.access_info, d.emerg_info
FROM prop_info p
LEFT JOIN location_code l ON p.location=l.id
LEFT JOIN direction_info d ON p.id=d.prop_num
WHERE (p.listing_type != 2)
ORDER BY p.prop_name
How exactly would you turn this into an SQL function in PostgreSQL?
Thanks in advance!
Eric
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks