pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Wallingford, Ted <twallingford@indexc.com>
To: 'Peter Landis' <ntwebdeveloper@yahoo.com>
To: pgsql-sql@postgresql.org
Cc: pgsql-sql@postgresql.org
Subject: RE: POSTGRESQL and PERL?
Date: Fri, 26 May 2000 12:14:16 -0400
Message-ID: <70866BD37E22D4119D8000600899F70D011CB8@INDEXAPP00> (raw)

Peter my guess is you can just substitute the variable name in for the
actual sortfield name..

select * from company order by $field;

That's why variables BEGIN with denotation characters in Perl rather than
ending with them (like in basic)..

Anyway, let me know if that works... and which module are you using to hit
PostgreSQL????

thax,
Ted

_________________________________________________
Ted Wallingford
Manager of Information Technology
Independence Excavating, Inc.
Precision Environmental Co.
Independence Communications, Inc.
www.indexc.com


> -----Original Message-----
> From: Peter Landis [mailto:ntwebdeveloper@yahoo.com]
> Sent: Friday, May 26, 2000 11:58 AM
> To: pgsql-sql@postgresql.org
> Cc: pgsql-sql@postgresql.org
> Subject: [SQL] POSTGRESQL and PERL?
> 
> 
> 
> Hi-
>    I'm a newbie at postgresql and was working on
> sorting by category.  What my question is, how do you
> sort by category when using a variable.  For instance,
> you can sort by name in perl by doing:
>  
> $sqh = $dbh->prepare(q{select name from company order
> by name;});
> $sqh->execute();
> 
> but what if you have a variable set like:
> $sort_selection = "name";
> 
> How do you sort by the variable?
> 
> For instance you cannot do:
> $sqh = $dbh->prepare(q{select name from company order
> by ?;});
> $sqh->execute($sort_selection);
> 
> OR
> 
> $sqh = $dbh->prepare(q{select name from company order
> by $sort_selection;});
> $sqh->execute();
> 
> If anyone could help, I would greatly appreciate it.
> 
> Thanks again!
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Kick off your party with Yahoo! Invites.
> http://invites.yahoo.com/
> 

Attachments:

  Wallingford, Ted.vcf (application/octet-stream, 136B) download

view thread (4+ messages)  latest in thread

Message-ID: <70866BD37E22D4119D8000600899F70D011CB8@INDEXAPP00>
Permalink:  ../70866BD37E22D4119D8000600899F70D011CB8@INDEXAPP00/
Also on:    postgresql.org/message-id/70866BD37E22D4119D8000600899F70D011CB8@INDEXAPP00

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: twallingford@indexc.com, ntwebdeveloper@yahoo.com
  Subject: Re: POSTGRESQL and PERL?
  In-Reply-To: <70866BD37E22D4119D8000600899F70D011CB8@INDEXAPP00>
  References: <70866BD37E22D4119D8000600899F70D011CB8@INDEXAPP00>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox