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.
Pls suggest me how to proceed.

Thanks in advance.
Padmaja T N.

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.
Pls suggest me how to proceed.

Thanks in advance.
Padmaja T N.

The query process is typically a 3-step process:
prepare
execute
finish

For example:

my $Q=qq{SELECT custid,CONCAT(firstname,' ',lastname) as name
         FROM newcustomers
         ORDER BY lastname,firstname,ShippingCity};
$sth=$dbh->prepare(qq{$Q});
$sth->execute();
while (@rows=$sth->fetchrow_array())
{
	print qq{<option value="$rows[0]">$rows[1]</option><br />\n};
}
$sth->finish();

A good book for you might be'MySQL' by Paul DuBois or also his 'MySQL and Perl for the Web'. The refs at http://dev.mysql.com/doc/ are also pretty good.

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.
Pls suggest me how to proceed.

Thanks in advance.
Padmaja T N.

Padmaja,

Are you trying to get a count of how many patients have the same patient intime? Or are you trying to get a list of patients or patient stats that all have the same intime?

I guess I need to understand what the purpose is a little better. Do you want:

a) List of total instances of each specific time in database.

7:20 4
7:22 3
7:31 5
7:32 2
etc.
Where the second number is the total amount of instances of that particular time in the database.

b) List of patients for a specific time. For instance, if $ARGV[0] equals 7:35 the return would be:

Patient name 1
Patient name 2
Patient name 3
Patient name 4
etc.
Because all of these patients would have the same intime of 7:35 in the database, for example.

c) Or do you just want to list all patients in order by intime?

Please give more information. Perhaps if you write an example for us of what you want your return to look like we could more easily guide you to the correct path to reach it.

Thanks,

Reno

This article has been dead for over six months. Start a new discussion instead.