If I’m trying to join three or more datasets but none of the datasets have a common entity, how can I do that without causing repeated rows? DISTINCT helps me avoid this problem but it wouldn’t work for cases in which people have the same first name or something.
For example, if I do something like this, it tends to return extra rows:
INNER JOIN [table2] ON [table1].[key] = [table2].[key]
INNER JOIN [table3] ON [table2].[key] = [table3].[key]
That is a time that you would want to use the DISTINCT keyword because it doesn’t eliminate rows from tables that have just one matching set of data, the entire row would have to match. Firstname, Lastname, etc.
EX: John Doe and John Smith could both be stored in the database and use a distinct keyword and it would display both names just fine.
Additionally, if the database stored Firstname, Lastname, and DateofBirth then John Doe 1/1/1981 and John Doe 2/2/1982 would also display just fine