[solved]Qualify unique values from a tale column

Sigþór Hrafnsson <[email protected]>
Newsgroups gmane.comp.web.webobjects.devel
Message-ID <[email protected]>
Here is the solution, would probably be a good idea to put some code in a 
framework to handle this kind of thing.

String sqlString; // Assume exists
String modelName; // Assume exists
NSArray results;
try {
     results = EOUtilities.rawRowsForSQL
         (this.session().defaultEditingContext(),sqlString,modelName);
} catch (Exception exception) {
     // Handle exception
}
return results;

The sql string I'm using is: "SELECT DISTINCT t0.\"IpAddress\"  FROM 
\"User\" t0;"

This gives a list of unique ip addresses from the user table. A better 
example is to qualify unique countries, then the
SQL string would be: "SELECT DISTINCT t0.\"Country\"  FROM \"User\" t0;" 
presuming that the user table has a
column named country.

ps. Using Frontbase, free for one and free for all.

Sigthor

------------------------------------------------------
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
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.