user1063189
user1063189

Reputation:

What's the syntax error here?

(Using postgresql 9.1)

I have a view and I'm trying to remove the row corresponding to the maximum values to find the second highest value. I want to store this new relation in another view.

CREATE VIEW SomeView AS

    SomeOtherView

    EXCEPT

    (SELECT *
    FROM SomeOtherView
    WHERE attribute = (SELECT max(attribute) FROM SomeOtherView));

It keeps telling me there's a syntax error around the first "SomeOtherView" but I can't seem to fix it.

Upvotes: 0

Views: 55

Answers (1)

Hogan
Hogan

Reputation: 70513

Replace SomeOtherView with

 SELECT * FROM SomeOtherView

Upvotes: 1

Related Questions