sql query for due dates | topic started 9/14/2005; 1:13:55 PM last post 9/15/2005; 8:11:44 PM |
|
|
Nandor Sieben - Re: sql query for due dates 9/15/2005; 8:11:44 PM (reads: 621, responses: 0) |
Here is a script that prints all due dates that are in the future. #!/usr/bin/perl # Duedates # Prints due dates # Author: Nandor Sieben $password = 'write your password here'; sub mysql { my ($sql) = @_; # print "$sql"; qx[mysql -s -u root -p$password webwork << EOF $sql EOF ]; } @tables= mysql(q[show tables like '%_set';]); $ctime=time; foreach $table (@tables) { chop $table; @rows=mysql(qq[select set_id, due_date from $table]); foreach $row (@rows) { $table =~s /.setZ//; if ( $row =~ /(S+)s+(S+)/) { $set=$1; $stamp=$2; if ($stamp < $ctime) { next; } $lt=localtime($stamp); print "$table \t $lt \t $set \n"; } } } |