From: | Herbert Liechti <Herbert(dot)Liechti(at)thinx(dot)ch> |
---|---|
To: | pgsql-general(at)hub(dot)org |
Cc: | Peter Landis <ntwebdeveloper(at)yahoo(dot)com> |
Subject: | Re: postgresql and perl? |
Date: | 2000-05-25 21:47:14 |
Message-ID: | 392D9F62.7E9D8CA9@thinx.ch |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(dot)Liechti(at)thinx(dot)ch
ThinX networked business services Stahlrain 10, CH-5200 Brugg
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2000-05-25 22:49:03 | Re: problem with NOTICE: _outNode: don't know how to print type |
Previous Message | Peter Landis | 2000-05-25 21:16:36 | postgresql and perl? |