if that doesnt work can oyou paste the current and expected results pls
Main Topics
Browse All Topics
I am using Multiple Table - Inner or Outer Join.
Issue is that - In the Output - Same row is replicated for 7 times.
I need to make the rows UNIQUE.
Example :- if i had 7 rows or 7 rows to be an actual output.
Now i am getting as 49 rows ...!
I did inner, left outer ..! any solution for my issue
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
if all the rows are exact copy of the original 7 rows you are expecting adding distinct as suggested by aneeshattingal will solve the problem atleast for the data you are testing. but i suspect actual problem is somewhere in your joins, you are missing some join. post your table structures along with the relations among the tables.
Business Accounts
Answer for Membership
by: aneeshattingalPosted on 2009-11-03 at 15:53:18ID: 25735198
SELECT DISTINCT Mem.LastName + ',' + Mem.FirstName as [Member Name], ME, AY AS [MEDEXPRESS COPAY], yID
CASE (MS.MedExpress) when 0 then 'MedExpress' WHEN 1 then 'Salisbury' else '' END as [Which Pharmacy],
IC.ICName,
PO.STATECD,
PO.PHARMACYORDERID,
VWCOPAYDETAIL.MEDICATIONNA
VWCOPAYDETAIL.COST,
VWCOPAYDETAIL.PLANALLOWS AS [ALLOWED AMOUNT],
VWCOPAYDETAIL.INSCOPAY AS [INSURANCE COPAY],
VWCOPAYDETAIL.SUGGESTEDCOP
VWCOPAYDETAIL.SAVINGS,
VWCOPAYDETAIL.PROFIT
FROM InsuranceCompanies IC
inner join MemberInsuranceCompany MemInsComp
on IC.InsuranceCompanyID = MemInsComp.InsuranceCompan
INNER JOIN PHARMACYORDERS PO
ON PO.MemberID = MemInsComp.MemberId
INNER JOIN PHARMACYORDERDETAILS POD
ON PO.PharmacyOrderID = POD.PharmacyOrderID
inner join Members as Mem
on Mem.MemberID = PO.MemberID
inner join MemberStatus as MS
on MS.MemberID = PO.MemberID
inner join VW_COPAYDETAILS as VWCOPAYDETAIL
on VWCOPAYDETAIL.MemberID = PO.MemberID
where PO.MemberID = 2464
AND POD.SHIPPED = 1
and VWCOPAYDETAIL.Active = 1
ORDER BY PO.PHARMACYORDERID DESC