>I will say right from the start that building SELECT-Sql statements is not my strong point, so perhaps someone can help me with this.
>
>The following People table holds name information and the Postal table holds mailing address information. It is possible that a person could be listed more than once in the People table (which is normal in this particular situation). The probem is I need to have only one final record output to the cursor for each person - so I can print Mailing labels - one per person.
>
>Can someone tell me what code I would add to this statement to achieve that. Adding DISTINCT does not give the results I need.
>
>
> SELECT People.*, Postal.address1, Postal.address2, Postal.city, ;
> Postal.state, Postal.zip, Postal.country ;
> FROM appdata!People ;
> INNER JOIN appdata!Postal ;
> ON People.postalid = Postal.postalid ;
> INTO TABLE THISFORM.MyTableFolder+'MyTable'
>
>Thanks,
>Mel Cummings
You can run your first select, then select distinct from it. Otherwise you have to group by People.PeopleID and each field except for ID should be some aggregative function, like min, but the result may be incorrect in such case...
If it's not broken, fix it until it is.
My Blog