Hi
Can someone help me please. My SQL isn't up to scratch. I'm having to bring back data from a number of tables that are linked via IDs etc.
The main table 'Profiles' is linked to 'RegionChosen'. There can be many regions to one profile. There's also a 'FieldChosen' table which is also linked to 'Profiles' and can have many to one.
When I'm getting the results back it's bringing back an entry from Profiles for every entry they've made in 'RegionChosen' and 'FieldChosen'. I've tried LEFT OUTER JOINS, RIGHT OUTER JOINS, FULL JOINS but to no avail.
So if for one profile a user has chosen 10 fields and 5 regions it's bringing back that profile 10 times in the results along with the rest. I've also tried DISTINCT but that didn't work either.
Can someone help me please. My SQL isn't up to scratch. I'm having to bring back data from a number of tables that are linked via IDs etc.
The main table 'Profiles' is linked to 'RegionChosen'. There can be many regions to one profile. There's also a 'FieldChosen' table which is also linked to 'Profiles' and can have many to one.
When I'm getting the results back it's bringing back an entry from Profiles for every entry they've made in 'RegionChosen' and 'FieldChosen'. I've tried LEFT OUTER JOINS, RIGHT OUTER JOINS, FULL JOINS but to no avail.
So if for one profile a user has chosen 10 fields and 5 regions it's bringing back that profile 10 times in the results along with the rest. I've also tried DISTINCT but that didn't work either.