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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 allowing duplicate results

Author  Topic 

homerjay80
Starting Member

26 Posts

Posted - 2007-04-24 : 21:20:37
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?
Thanks

Example:
select * from employees
where 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 Kizer
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

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 this

555555555 Jane Doe
555555555 Jane Doe
444444444 John Doe
444444444 John Doe
444444444 John Doe
444444444 John Doe

Doing the union all just gave me

555555555 Jane Doe
555555555 Jane Doe
444444444 John Doe
444444444 John Doe


Thanks

Go to Top of Page

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 Kizer
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

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
Go to Top of Page
   

- Advertisement -