Search Postgresql Archives

Re: SQL questiom

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hamann.w@xxxxxxxxxxx writes:

> I am using a query pretty often that looks like
> SELECT <<fixed columns from tables>> WHERE <<fixed join statements>> AND
> <<actual select criterion>>
>
> Is there a way (with sql or plpgsql)  to convert that into
> SELECT myquery('<<actual select criterion>>')

I would solve that by creating a view like:

CREATE VIEW some_view_name AS 
  SELECT <<fixed columns from tables>> WHERE <<fixed join statements>>;

See also https://www.postgresql.org/docs/14/sql-createview.html

Then you can query that view with your actual select criterion like:

SELECT * FROM some_view_name WHERE <<actual select criterion>>;

Best regards,
Jacob






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux