sub-selects
| От | Mark Fenbers |
|---|---|
| Тема | sub-selects |
| Дата | |
| Msg-id | 4288F867.8090600@noaa.gov обсуждение исходный текст |
| Ответы |
Re: sub-selects
|
| Список | pgsql-sql |
Is there a way to make a query more efficient by executing a sub-select only once?<br /><br /> In a query such as:<br /><br/><tt>SELECT a, (select b from c where d = e limit 1), npoints( (select b from c where d = e limit 1) )<br /> FROMf<br /> WHERE isValid( (select b from c where d = e limit 1) );<br /></tt><br /> I do the same sub-select 3 timesin the query. I tried the following:<br /><br /><tt>SELECT a, (select b from c where d = e limit 1)<b> AS g</b>, npoints(<b>g</b> )<br /> FROM f<br /> WHERE isValid( <b>g</b> );<br /></tt><br /> But this gave an error regarding"column 'g' does not exist". How can I avoid making the same sub-select 3 times? <br /><br /> Mark<br />
В списке pgsql-sql по дате отправления: