Link to home
Start Free TrialLog in
Avatar of ukerandi
ukerandiFlag for United Kingdom of Great Britain and Northern Ireland

asked on

t-sql Joining Issue

Hi , I have write code for Joining 2 tables.But it's not working properly. Any idea where I have to change.
It's duplicating same line 2 times.

Please attached excel sheet, it's showing 2 table  and expected out put .

This is SQL SERVER 200R2
SELECT  A.Invoice Number,B.[Order Number],B.[F_Cost],B.[VendorNumber]




FROM TABLEB B

LEFT OUTER JOIN TABLEA  A ON B.Order_Number=A.Order_Number AND B.[Order Number Line]= A.[Order Number Line]

Open in new window

Query.xlsx
ASKER CERTIFIED SOLUTION
Avatar of Pawan Kumar
Pawan Kumar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,
Try to put
seleect distinct ...

Open in new window

SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ukerandi

ASKER

@Ryan Chong

Can you give me a example how to do data mining related to above example.
Thanks
what i mean by a better data mining approach is actually referring to the possibility to add "Invoice Number" into your TableB, if that's feasible. By doing that we can ensure both comparison of TableA and TableB will not produce duplicate entries and that ensure your data accuracy.
Hi Author,
Is there no more other question to this thread? If yes, we would close this!
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ukerandi, a feedback will be appreciated.
Cheers
Thanks