Re: SQL questiom

2022-01-21 Thread Jacob Bunk Nielsen
haman...@t-online.de writes:

> I am using a query pretty often that looks like
> SELECT <> WHERE <> AND
> <>
>
> Is there a way (with sql or plpgsql)  to convert that into
> SELECT myquery('<>')

I would solve that by creating a view like:

CREATE VIEW some_view_name AS 
  SELECT <> WHERE <>;

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 <>;

Best regards,
Jacob





Re: SQL questiom

2022-01-21 Thread Thomas Boussekey
Le ven. 21 janv. 2022 à 11:14,  a écrit :

>
>
> Hi,
>
> I am using a query pretty often that looks like
> SELECT <> WHERE <> AND
> <>
>
> Is there a way (with sql or plpgsql)  to convert that into
> SELECT myquery('<>')
>
> Kind regards
> Wolfgang Hamann
>
>
>
> Hello Wolfgang,

You can use a FUNCTION
 to
perform this operation

HTH,
Thomas


SQL questiom

2022-01-21 Thread hamann . w



Hi,

I am using a query pretty often that looks like
SELECT <> WHERE <> AND
<>

Is there a way (with sql or plpgsql)  to convert that into
SELECT myquery('<>')

Kind regards
Wolfgang Hamann