Phillip Smith wrote:
I'm trying to create a view of the query below, but I'm being barked at about "rules on SELECT must have action INSTEAD SELECT". I don't have any rules in my database, and I don't know how this query is trying to create one. The query does work if I just run it interactively. Any help would be much appreciated.
You have two queries here - which one is giving the problem?
SELECT DISTINCT ON (m1.id)
...
; SELECT d.id AS "ID",
...
;
-- Richard Huxton Archonet Ltd ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend