I've used triggers before in another DB where the total functionality was included in the CREATE TRIGGER statement, totally written in SQL. I understand that postgresql can't do that (correct?).
I want to delete a row in table 2 when I update table 1, with something along the lines of :
CREATE...
You can use SELECT DISTINCT ON instead of SELECT DISTINCT and specify the field to use it on.
SELECT DISTINCT ON (country) id, country
FROM mytable
WHERE country = 'UK';
The field that you use the DISTINCT ON modifier on must be listed in parentheses before your list of the fields.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.