I want to ask for technology on retriving from a table two values in
single request. Say, I can do (MySQL query):
select id where name="q";
And through DBI on say $row[0] have the id. But! How to in single
request if I want to retrive 2 ids: for name="q" and for name="w"?
It is a great optimization
On 12/7/05 10:57 AM, "Strong" <[EMAIL PROTECTED]> wrote:
> I want to ask for technology on retriving from a table two values in
> single request. Say, I can do (MySQL query):
> select id where name="q";
> And through DBI on say $row[0] have the id. But! How to in single
> request if I want to r
On 12/7/05, Sean Davis <[EMAIL PROTECTED]> wrote:
> Select id from table where name in ('q','w');
Yes, that will technically work. However, how does your solution tell
me which id corresponds to q and which to w?
Much better would be:
SELECT name, id
FROM table
WHERE name IN ( 'q', 'w' )
The
On 12/8/05, Rob Kinyon <[EMAIL PROTECTED]> wrote:
> On 12/7/05, Sean Davis <[EMAIL PROTECTED]> wrote:
> > Select id from table where name in ('q','w');
>
> Yes, that will technically work. However, how does your solution tell
> me which id corresponds to q and which to w?
>
> Much better would be:
> -Original Message-
> From: Rob Kinyon [mailto:[EMAIL PROTECTED]
> Sent: Thursday, December 08, 2005 4:53 PM
> To: Sean Davis
> Cc: Strong; cgiapp@lists.erlbaum.net
> Subject: Re: [cgiapp] Double MySQL query thru DBI.
> [...]
> The Perl for this could look
On Thu, 8 Dec 2005 19:11:45 +0100 "Emanuele Zeppieri"
<[EMAIL PROTECTED]> wrote:
> my @names = @_;
> >
> > my $sql = 'SELECT name, id FROM table WHERE name IN (';
> > $sql .= join( ',', ('?') x @names );
> > $sql .= ')';
Excuse me for a silly question, but when I executed this:
@names
> -Original Message-
> From: Strong [mailto:[EMAIL PROTECTED]
> Sent: Saturday, December 10, 2005 9:36 AM
> To: cgiapp@lists.erlbaum.net
> Subject: Re: [cgiapp] Double MySQL query thru DBI.
>
>
> On Thu, 8 Dec 2005 19:11:45 +0100 "Emanuele Zeppieri"
&