[jifty-devel] Howto: Select Distinct in Jifty::DBI
Jes
jjjesss at gmail.com
Sat May 29 07:09:39 EDT 2010
El Fri, 28 May 2010 12:28:36 -0400
Jesse Vincent <jesse at 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 at lists.jifty.org
> > http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
> _______________________________________________
> jifty-devel mailing list
> jifty-devel at 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
More information about the jifty-devel
mailing list