• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to do a "SELECT DISTINCT"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to do a "SELECT DISTINCT"


  • Subject: Re: How to do a "SELECT DISTINCT"
  • From: Chuck Hill <email@hidden>
  • Date: Tue, 22 Mar 2005 13:49:56 -0800

I'm not sure that Sacha's suggestion is what you want. If you want to get all of the rows that have a unique name in them, then EOF is not going to be helpful. The reason is that EOF maps objects to some external, persistent, representation. It is very, very concerned with maintaining the connect of an object to its external representation. If there are multiple rows with the same name, SELECT DISTINCT will return the data from one of them, but which one is not known. So your fetch, if it were possible, would be saying to EOF "get me some random objects, but make sure they have unique names". It is just not built for that. I can't even think of how to do this in SQL, return entire rows where the values in column are unique, but its been a while since I had to do things like that in SQL.

If you want a list of names to use in a lookup list, then you should further normalize your data do that the unique names are held in their own object / table.

Chuck


On Mar 22, 2005, at 1:23 PM, Sacha Mallais wrote:

On Mar 22, 2005, at 1:03 pm, Sébastien Gruhier wrote:

I would like to perform a "select distinct" on my database.
Actually I do a fecthSpecification like this
EOFetchSpecification fetchSpec = new EOFetchSpecification("Table",
new EOKeyValueQualifier("attribute",
EOQualifier.QualifierOperatorEqual,
new Integer(1)),
null);
editingContext.objectsWithFetchSpecification(fetchSpec);


I get all elements from Table that have "attribute = 1". I would like to add something like only with a distinct "name".
Any ideas?


RTFM: http://developer.apple.com/documentation/WebObjects/Reference/API/com/ webobjects/eocontrol/ EOFetchSpecification.html#setUsesDistinct(boolean)



--
Practical WebObjects - a book for intermediate WebObjects developers who want to increase their overall knowledge of WebObjects, or those who are trying to solve specific application development problems.
http://www.global-village.net/products/practical_webobjects




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: How to do a "SELECT DISTINCT"
      • From: Sacha Mallais <email@hidden>
References: 
 >How to do a "SELECT DISTINCT" (From: Sébastien Gruhier <email@hidden>)
 >Re: How to do a "SELECT DISTINCT" (From: Sacha Mallais <email@hidden>)

  • Prev by Date: Re: How to do a "SELECT DISTINCT"
  • Next by Date: Re: How to do a "SELECT DISTINCT"
  • Previous by thread: Re: How to do a "SELECT DISTINCT"
  • Next by thread: Re: How to do a "SELECT DISTINCT"
  • Index(es):
    • Date
    • Thread