in reply to Duplicated values in a For Loop
I'm really reaching here, but assuming a well-normalized database the SQL query probably joins three tables, something like:
If this is the case, you're getting multiple rows for users with multiple telephone numbers and/or email addresses.select p.number, p.user, p.first, p.lastn, t.tel, e.email from people p left join telephone t on t.number = p.number left join email e on e.number = p.number
Changing the SQL query to get distinct users would require some way to select only one each tel and email.
If I'm guessing correctly, and changing the query is feasable, I'd need the database type (Oracle, MSSQL, MySQL, etc.) and the table schemas to work out a suitable WHERE clause.
|
|---|