Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
hello I want to run this query to return duplicates in my result. So instead of getting 3 results, I want to return 6. Is this possible?ThanksExample:
select * from employeeswhere ssn in ('55555555','555555555','999999999','999999999','999999999','888888888',)
tkizer
Almighty SQL Goddess
38200 Posts
Posted - 2007-04-24 : 21:27:36
Do the duplicates exist in the employees table?If not, then I guess you can repeat the query with a UNION ALL. Tara Kizerhttp://weblogs.sqlteam.com/tarad/
homerjay80
Starting Member
26 Posts
Posted - 2007-04-24 : 21:44:16
Yeah, when I did that it just duplicated my unique results. I need to see a row return for each ssn in my where clause. The results should look like this555555555 Jane Doe555555555 Jane Doe444444444 John Doe444444444 John Doe444444444 John Doe444444444 John DoeDoing the union all just gave me555555555 Jane Doe555555555 Jane Doe444444444 John Doe444444444 John DoeThanks
tkizer
Almighty SQL Goddess
38200 Posts
Posted - 2007-04-24 : 22:09:25
Please show us what the data in the table looks like.Tara Kizerhttp://weblogs.sqlteam.com/tarad/
homerjay80
Starting Member
26 Posts
Posted - 2007-04-24 : 22:15:23
Its ok now.By joining a separate table and including another column name on the original table I was able to reproduce all the rows.Thanks