[jifty-devel] Howto: Select Distinct in Jifty::DBI
ruz at bestpractical.com
Tue Jun 1 09:47:53 EDT 2010
I believe it's usable operation and deserves a method in collection.
In the attachment you can find patch for Jifty::DBI that demonstrates
how method will probably look. I didn't test the patch even if it
compiles or not.
If it works for you and other people have no objections then I can
push it into trunk.
On Sat, May 29, 2010 at 3:09 PM, Jes <jjjesss at gmail.com> wrote:
> El Fri, 28 May 2010 12:28:36 -0400
> Jesse Vincent <jesse at bestpractical.com> escribió:
>> What are you actually trying to do?
>> On Fri 28.May'10 at 11:19:51 +0200, Jes wrote:
>> > Hi all:
>> > How can I do a query like:
>> > SELECT DISTINCT myfield FROM mytable
>> > ???
>> > I'm used to deal with records and collections but I can't figure out
>> > how this can be coded (first time I have to deal with).
>> > Thanks in advance,
>> > Jes
>> > _______________________________________________
>> > jifty-devel mailing list
>> > jifty-devel at lists.jifty.org
>> > http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
>> jifty-devel mailing list
>> jifty-devel at lists.jifty.org
> Well, I have several models. One of them has a lot of columns. There
> are a lot of records with one column in common. This column is called
> "ine", and the model is called "Celda". So, for example, to find all
> records for a particular value of "ine" I'd do:
> my $cells = ImpactoWeb::Model::CeldaCollection->new;
> column => 'ine',
> value => $ine
> while ( my $cell = $cells->next )
> .... rest of the code...
> As well I need to find all different values of column "ine". In SQL I'd
> SELECT DISTINCT ine FROM Celda;
> or something similar. I'm only want to get an array, for example, with
> all different values of "ine".
> Thanks, bye
Best regards, Ruslan.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1113 bytes
Desc: not available
More information about the jifty-devel