Basically I want to sort data returned by an sql query.
my $sth = $dbh->prepare("SELECT Title, Age, name FROM Jobs ORDER BY Title"
while (my ($title, $age, $name) = $sth->fetchrow_array) {
print "$title<br>";
}
When using "ORDER BY Title" the data returned looks like:
Electrician 1
Thief 10
Brick Layer 11
Chef 2
Homemaker 3
Officer 4
Desk Clerk 5
Pornstar 6
Dj 7
Pimp 8
Nurse 9
But somehopw I need to sort this data to look like:
Electrician 1
Chef 2
Homemaker 3
Officer 4
Desk Clerk 5
Pornstar 6
Dj 7
Pimp 8
Nurse 9
Thief 10
Brick Layer 11
Any suggestions.. Thanks in advance
my $sth = $dbh->prepare("SELECT Title, Age, name FROM Jobs ORDER BY Title"
while (my ($title, $age, $name) = $sth->fetchrow_array) {
print "$title<br>";
}
When using "ORDER BY Title" the data returned looks like:
Electrician 1
Thief 10
Brick Layer 11
Chef 2
Homemaker 3
Officer 4
Desk Clerk 5
Pornstar 6
Dj 7
Pimp 8
Nurse 9
But somehopw I need to sort this data to look like:
Electrician 1
Chef 2
Homemaker 3
Officer 4
Desk Clerk 5
Pornstar 6
Dj 7
Pimp 8
Nurse 9
Thief 10
Brick Layer 11
Any suggestions.. Thanks in advance