arc_of_descent has asked for the wisdom of the Perl Monks concerning the following question:
This is not really a perlish question, although I am developing a Web App using Perl, Class::DBI and the Template Toolkit. Its more a SQL question, and so excuse me if I've run the wrong way.
First off - Is there any way to specify a "order by" phrase in the retrieve_all method of the Class::DBI module? Is there any way, I can specify the 'ASC' or 'DESC' words, apart from using retrieve_from_sql?
Now for the SQL!
I have the following 2 tables:
Table customer:
| code | name | region |
|---|---|---|
| 1 | Me | 1 |
| 2 | Myself | 2 |
| 3 | You | 3 |
| id | name |
|---|---|
| 1 | Mumbai |
| 2 | Delhi |
| 3 | Chennai |
Now I would like to sort and retrieve the customer table, based on region name and not on region id, which the following SQL statement does:
SELECT * FROM customer ORDER BY region
I tried the following:
SELECT customer.* FROM customer, region ORDER BY region.name
but i'm getting horribly stuck!
Any help would be most welcome.
Thankz
--
arc_of_descent
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Class::DBI and sql order by
by jeffa (Bishop) on Nov 15, 2003 at 16:12 UTC | |
by Anarion (Hermit) on Nov 16, 2003 at 11:25 UTC | |
|
Re: Class::DBI and sql order by
by perlcgi (Hermit) on Nov 15, 2003 at 15:02 UTC |