for any sql dummies like me that come this way in future, this was the answer:

my $t = $c->model('Schema')->resultset('Phrases')->
         count( { language_id => 3},
                    { group_by => 'orig_id'} );

which works like this sql query :

select count (distinct orig_id) from phrases where (language_id = 3);

D


On 1/5/07, Daniel McBrearty <[EMAIL PROTECTED]> wrote:
I'm reading the POD at

http://search.cpan.org/~bricas/DBIx-Class-0.07003/lib/DBIx/Class/ResultSet.pm#count

but not really getting it, or whether it's what I want to solve this
particluar case.

I have a table :

Phrases

id INT PK
orig_id REFERENCES id
languuage_id REFERENCES languages.id

Now what I want to do is count the number of phrases in the table that
have a given language, but for which the orig_id is distinct.

How would I write such a query in DBIx ?

Thanks

Daniel



--
Daniel McBrearty
email : danielmcbrearty at gmail.com
www.engoi.com : the multi - language vocab trainer
BTW : 0873928131



--
Daniel McBrearty
email : danielmcbrearty at gmail.com
www.engoi.com : the multi - language vocab trainer
BTW : 0873928131

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to