I have a table of people and a table of roles. A person can have several roles. I have a query which joins the two. How do I only return one of the joins per person - I don’t care which join it returns. I needs all columns from both tables.
If you are linking from one person to many rules, but don’t care which is returned then you can group on the user’s id (the primary key of the first table) and that’ll return a single line for users then.
I’m not sure about MS SQL but I know mySQL has a ‘group_concat’ function which would allow you to make, for example, a comma separated list of roles.
This is formatting that would be done in the application language after the result has been returned from the database with all the duplicates in raw form.