Hi Monks,

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:
codenameregion
1Me1
2Myself2
3You3

Table region:
idname
1Mumbai
2Delhi
3Chennai

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


In reply to Class::DBI and sql order by by arc_of_descent

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.