Thanks for the helpful replies so far. I think that maybe I wasn't entirely clear, however. I was thinking of returning a list of distinct objects:
table units: name location ------------------ foo_unit 1 foo_unit 2 bar_unit 1 baz_unit 3
I was hoping to find something like:
$iterator = Package::units->search_distinct(name); while ($iterator->next) { print }; foo bar baz
While the first suggestion will allow me to do this (thank you), I was hoping that I could find a way to do it without hardcoding each individual query into the class.

Regarding the schema: It is part of an existing project that cannot (easily) be changed.


In reply to Re: Re: Class::DBI 'distinct' records by grazer
in thread Class::DBI 'distinct' records by grazer

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.