Re: Fetching values in Perl
Baron Schwartz <[email protected]> Fri, 28 Sep 2007 09:20:53 -0400
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Message-ID | <[email protected]> |
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.
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]