My boss has given me an assignment that I'm not sure is possible since after about two weeks, I can't figure out a solution, so I'm throwing this out to ask for any sort of help from the SO group. If this breaks your brain, I apologize.
A little background first: We develop a database querying application that allows users to get back anything they want from the database without having to know any SQL.
My Problem: We want to customize way a "Distinct" selection is used. Instead of having the distinct keyword apply to the rows selected, we want it to apply to only certain fields, so that the first rows that match the fields will get used. For an example:
Bob Jones, 122 Main Street, Portland, OR
Sue Jones, 122 Main Street, Portland, OR
Mary Smith, 458 32nd Street, Portland, OR
Ralph Smith, 458 32nd Street, Portland, OR
we want this to work so that only the first rows for each address is returned as follows:
Bob Jones, 122 Main Street, Portland, OR
Mary Smith, 458 32nd Street, Portland, OR
With the normal distinct, all four rows would be returned, which is more than we want. Does anyone have any ideas as to how we can go about doing this? Thanks.