Re: postgresql and perl?
| От | Herbert Liechti |
|---|---|
| Тема | Re: postgresql and perl? |
| Дата | |
| Msg-id | 392D9F62.7E9D8CA9@thinx.ch обсуждение исходный текст |
| Ответ на | postgresql and perl? (Peter Landis <ntwebdeveloper@yahoo.com>) |
| Список | pgsql-general |
Peter Landis wrote:
>
>
> How do you sort by the variable?
>
> $sqh = $dbh->prepare(q{select name from company order
> by $sort_selection;});
> $sqh->execute();
Your problem is not Perl specific. The order by column
must be in the result set (projection). Why not doing
it this way:
my @fields = qw/name zip location/;
push @fields, $sort_selection;
$sqh = $dbh->prepare( "SELECT " . join(', ', @fields) .
" FROM company ORDER BY $sort_selction; );
$sqh->execute();
Greetings Herbie
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Herbert Liechti E-Mail: Herbert.Liechti@thinx.ch
ThinX networked business services Stahlrain 10, CH-5200 Brugg
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
В списке pgsql-general по дате отправления: