Simple Perl

From: Mahtaj Khamneian (khamneianm_at_umsystem.edu)
Date: 12/17/03


Date: Wed, 17 Dec 2003 15:29:55 -0600
To: <dbi-users@perl.org>

I have a query that returns the following data from the db:
...
operid emplid course
-------- ---------- ---------
SSPT490 12050971 37290
SSPT490 12050971 38380
SSPT490 12050971 38540
SSPT490 12050971 52320
SSPT491 12051127 12020
SSPT491 12051127 18240
SSPT491 12051127 27910
SSPT491 12051127 34280
SSPT491 12051127 37260
SSPT491 12051127 38220
SSPT491 12051127 52320
SSPT492 12051223 12100
SSPT492 12051223 17039
SSPT492 12051223 17080
SSPT492 12051223 18088
SSPT492 12051223 18260
SSPT492 12051223 38380
SSPT492 12051223 38540
SSPT492 12051223 51368
SSPT492 12051223 52320
SSPT493 12051298 12060
SSPT493 12051298 12559
SSPT493 12051298 12560
SSPT493 12051298 18220
SSPT493 12051298 34500
SSPT493 12051298 38100
SSPT493 12051298 52320
SSPT494 12051322 13420
SSPT494 12051322 18220
SSPT494 12051322 28228
SSPT494 12051322 48040
SSPT494 12051322 50540
...

Noting that different courses are associated with the same oprid and emplid,
I need to format the output so that a single line is printed for each oprid.
e.g.,
SSPT490 12050971 37290 38380 38540 52320

I have used both fetchall_arrayref() and fetchrow_array() methods to fetch the data.
I can think of a quick and dirty way of doing this, but was looking for an efficient/elegant way.

Any/all help is appreciated.

-------------------------------------
Mahtaj Khamneian
University of Missouri - ASP Phone : (573) 884-2281
1805 East Walnut Fax : (573) 884-3070
Columbia, MO 65201-6425 khamneianm@missouri.edu
I wish I were able to create a program that could ping my mind.
I would then load it into the creation's/nature's server, for which
no root access is needed, and invoke it via cron at spontaneous
intervals.



Relevant Pages

  • Re: Simple Perl
    ... >> each oprid. ... leading tab separator. ... may be less overhead (see the DBI book, DBI pod, and numerous ...
    (perl.dbi.users)
  • Re: Simple Perl
    ... > Noting that different courses are associated with the same oprid and emplid, ... > I need to format the output so that a single line is printed for each oprid. ...
    (perl.dbi.users)