Is there a way to use DISTINCT on a single field in Rose::DB?
I have a table like

    +----+---------------------+-----------+
    | id | event_time          |  some_val |
    +----+---------------------+-----------+
    |  1 | 2006-12-03 09:15:00 |         1 |
    |  2 | 2006-12-03 09:15:00 |         2 |
    |  3 | 2006-12-03 09:15:00 |         3 |
    |  4 | 2006-12-03 09:15:00 |         4 |
    |  5 | 2006-12-03 09:16:00 |         1 |
    |  6 | 2006-12-03 09:16:00 |         2 |
    |  7 | 2006-12-03 09:16:00 |         3 |
    |  8 | 2006-12-03 09:16:00 |         4 |
    |  9 | 2006-12-03 09:17:00 |         1 |
    | 10 | 2006-12-03 09:17:00 |         2 |
    +----+---------------------+-----------+

and I'd like to perform a query like

    SELECT DISTINCT some_val from some_table
    WHERE event_time > ...

to get all distinct values of some_val after a given time. Using

    my $events = WatchLAN::Activity::Manager->get_some_table(
        query      => [ event_time => { gt => ... },
                      ],
        distinct   => 1,
    );

yields

    SELECT DISTINCT id, event_time, some_val from some_table
    WHERE event_time > ...

since I'm using Rose::DB::Object::Loader, and all columns are mapped
automatically into Rose. The latter of course doesn't return
distinct values of some_val, but distinct rows.

Is there a way to say "just fetch these columns and use distinct"
in the manager or is there a better way to get the distinct
values of some_val?

-- Mike

Mike Schilli
[EMAIL PROTECTED]

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to