I think this is a very easy problem to solve. I am using the Adapter setup.
Here is the relation:
Listing [1 - M] ListingKeyword
The relevant fields:
Listing
-ListingId (PK)
ListingKeyword
-ListingId (FK on Listing.ListingId)
-KeywordId (FK on a table Keyword)
The desired output in SQL
SELECT DISTINCT Listing.*
FROM Listing INNER JOIN
ListingKeyword ON Listing.ListingId = ListingKeyword.ListingId
Where ListingKeyword.KeywordId = "..."
The part I can't figure out is how to get the "DISTINCT" or unique rows based on Listing only. I want to filter with ListingKeyword but not retain their fields, otherwise I will be returned many rows for the same Listing, since a Listing can have many associated ListingKeywords.
What is the BEST way to do this? I don't want to write SQL Syntax in code.
Another feature is that I want to add other tables related to Listing and potentially filter on any of the fields. See the sample relation below:
Listing [M - 1] ListingLocation [M - 1] City
So I thought that using a TypedList would aid with this, except that I can't figure out how to use include/exclude desired fields so that I can remove "duplicate" rows.
Thanks for the help.