Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
arcticpro
Starting Member
6 Posts |
Posted - 2011-01-20 : 19:57:22
|
Hi, I am trying to create a report showing all employees in our company and then include hobbie, skill, and goal info where applicable. So I am joining a total of 4 tables. I get the report to run. If there are two hobbies it creates two rows for the employee as expected, but if there is only one skill or goal, it repeats that data in the second row. How can I have my query omit data when it's duplicate? Here's what I have now:select p.employeename, ph.hobbie, ps.skill, pg.goal from employee p left outer join hobbies ph on p.id = ph.id left outer join skills ps on p.id = ps.id left outer join goals pg on p.id = pg.id order by p.employeenameGives results like this:Joe Swimming C++ PythonJoe Hiking C++ PythonI would like to get this:Joe Swimming C++ PythonJoe HikingThanks. |
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2011-01-21 : 04:36:18
|
That's a presentation issue which is best resolved using your front-end presentation tool.SQL will just return all the data. |
|
|
arcticpro
Starting Member
6 Posts |
Posted - 2011-01-21 : 12:18:46
|
Unfortunately we don't have a front-end tool. I supply raw SQL reports, so want to be able to remove this duplicate data. |
|
|
|
|
|