Original Post
I have a MySQL table: (pseudo-code) ListingFieldData(ParentListingID INT, Value LONGTEXT) A basic search queries the Value, and returns all of the ParentListingIDs relevant to the query. (There may be 30+ ListingFieldData rows per each ParentListingID - and possibly thousands of "Parent Listings" - meaning potentially hundreds of thousands of ListingFieldData rows in total.) * The problem is that the search only needs to return each ParentListingID once, instead of hundreds of thousands of times. I've experimented with both the "DISTINCT" and "GROUP BY" keywords, both to no avail. The GROUP BY is the closest I've gotten, but it doesn't seem to work the way I need it to (I'm probably using it wrong). I have a feeling that I'm grossly overlooking something...something simple... Question) is there a way to get MySQL to return only "distinct" ParentListingIDs, skipping ParentListingIDs that have already been found? Perhaps there is some sort of "DISTINCT COLUMN" functionality? (Note: I need this operation to be performed MySQL-server-side, instead of "manually" trimming duplicate ListingFieldIDs with a PHP routine) Thanks for any help. [Edited by - swordfish on September 29, 2007 8:20:13 PM]