Re: Fetching values in Perl
Eric Frazier <[email protected]> Fri, 28 Sep 2007 10:33:03 -0300
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Message-ID | <[email protected]> |
Baron Schwartz wrote:
> Hi,
>
> padmaja wrote:
>> Hi all,
>> I have written a query like this.
>> ----------------------------------------------------------
>>
>> $dbh= DBI->connect("dbi:mysql:dbname=$database;host=$hostname",
>> "$username",
>> "$password");
>>
>> $statement = "SELECT patient_intime from $table_name where
>> patient_intime=$ARGV[0])";
>>
>>
>> ----------------------------------------------------------
>> I want all the "patient_intime" values to be retreived, where there are
>> other columns(fields) also.
>
Sorry to reply to a reply, I didn't see the first post.
Are you saying you want to do SELECT patient_intime FROM $table_name
WHERE field1 IS NOT NULL AND field2 IS NOT NULL etcl.......
I am not really sure what the question is..
Eric
> Try this:
>
> SELECT * FROM $table_name ....
>
> SELECT * is not a good idea to just blindly write, though. In general
> it's a much better idea to explicitly name the columns you know you
> need (it's more efficient, you don't get any nasty surprises when
> someone adds another column to the table, you will get an explicit
> error when someone drops a column your application actually needs...)
>
> Baron
>
--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/[email protected]