Hello, Jes. 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 <jjje...@gmail.com> wrote: > El Fri, 28 May 2010 12:28:36 -0400 > Jesse Vincent <je...@bestpractical.com> escribió: > >> >> Jes, >> >> What are you actually trying to do? >> >> Best, >> Jesse >> >> 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@lists.jifty.org >> > http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel >> _______________________________________________ >> jifty-devel mailing list >> jifty-devel@lists.jifty.org >> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel > > > Hi: > > 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; > $cells->limit( > 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 > do: > > 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 > > Jes -- Best regards, Ruslan.
Jifty-DBI-collection_distinct_column_values_method.patch
Description: Binary data
_______________________________________________ jifty-devel mailing list jifty-devel@lists.jifty.org http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel