Re: Qualify unique values from a tale column

"Jerry W. Walker" <[email protected]>
Newsgroups gmane.comp.web.webobjects.devel
Message-ID <[email protected]>
Hi, Sigthor,

I think that the only way you're going to pull this one off is to use  
the EOUtilities method:

   public static NSArray rawRowsForSQL(EOEditingContext ec,
                                     String modelName,
                                     String sqlString,
                                     NSArray keys)

Then supply a sqlString with "SELECT DISTINCT" to obtain unique  
values for that given column (ip).

You can turn the returned raw row NSDictionaries into full fledged  
EOs using the EOEditingContext method:

    public EOEnterpriseObject faultForRawRow(NSDictionary row,
                                          String entityName,
                                          EOEditingContext context)

Regards,
Jerry

On May 23, 2006, at 7:12 AM, Sigþór Hrafnsson wrote:

> This is completely eluding me.
>
> I want to qualify based on unique values from a column in a table,  
> like
>
> Have a table User with a column ipAddress, in the table there can  
> be more that one user by the same name with the same
> ipAddress but a different table id.
>
> User Table example
>
> User john ip 111 id 1 (simplified for demonstration)
> User Bart ip 222 id 2
> User Elsa ip 333 id 3
> User john ip 111 id 4
>
> With the EOQualifier, I would like to get the result for table id's  
> 1, 2 and 3 but not 4, or it could also be id's 2, 3 and 4 but not 1.
>
> I know how to do the sort in memory, but I don't want to fetch all  
> the tables to memory, I want to qualify them at the DB level.
>
> Thanks
>
> Sigthor
>
> _______________________________________________
> WebObjects-dev mailing list
> [email protected]
> http://www.omnigroup.com/mailman/listinfo/webobjects-dev


--
__ Jerry W. Walker,
    WebObjects Developer/Instructor for High Performance Industrial  
Strength Internet Enabled Systems

     [email protected]
     203 278-4085        office
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.