Show SQL duplicated result

Dear expert

I got question about duplicating the query, now when I select query like code below the sql automaticly remove the duplicated result, the deal here is I want SQL to show duplicated result... how to do that?
SELECT [Membership]
      ,[Membershipid] ,[firstnamn]
  FROM [company].[db].[Member]
  Where membershipID in ('392102','392371', '394240', '394240', '394910', '394910', '395173'
, '395173', '395173', '395189', '395189', '395189', '395782','396232', '396232', '396232', '396509', '396509', '396509'
,'398145', '398166' ,'399037' , '399230', '401361', '401361'
,'401361', '401361', '411750', '411856' , '412141' , '412141'
,'414297' , '414297','414770','414770','415043','415043','415288','416131','416251','416251','416251','416917','417459',

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Geert GOracle dbaCommented:
there is probably no duplicate in the result, you are assuming this wrongly
if a row matches a criteria, it matches,
it won't return the same row more if it matches the criteria multiple times

if you have duplicates in your data, then they will show

if you have duplicates in your search criteria, then those are ignored
you have duplicates in your search criteria

how did you build that search criteria ?
you need to look there for duplicates

insert your search criteria into a separate table
and then check that separate table with a group by

select medlemsnr, count(*) 
from separate_table
group by medlemsnr 
having count(*) > 1

Open in new window

WeTiAuthor Commented:
Compare with a excel, in excel there are duplicated lines with other info, I just need to export this query to copy the result in it, I thought... However the query auto remove all the duplicated ids... I cannot mark all and copy...
WeTiAuthor Commented:
Sorry, I forgot to edit the search criteria. now its correct.
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

WeTiAuthor Commented:
You said:
if you have duplicates in your search criteria, then those are ignored
you have duplicates in your search criteria

Yes I need sql to show those duplicates in my search criteria... not ignore them.
Geert GOracle dbaCommented:
then insert them into a separate table
with a join you can have duplicates

how do you mean now it is correct ?
your search criteria has still got duplicates

that's 3 of these :
'395173', '395173', '395173'
WeTiAuthor Commented:
Yes that is my question, I want sql to show those duplicate...
Geert GOracle dbaCommented:
you can't with an in clause

insert those numbers into a new separate table
and then join with that separate table

create table #crit (membershipID int);

insert into #crit (membershipId) values (392102);
insert into #crit (membershipId) values (392371);
... etc 

SELECT m.[Membership]
      ,m.[Membershipid] ,m.[firstnamn]
  FROM [company].[db].[Member] m, #crit c 
  Where m.membershipID = c.membershipID;

Open in new window

that'll give you the duplicates

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
WeTiAuthor Commented:
Great solution! Thanks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.