.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Post New Resource Bookmark and Share   

Query to Remove Duplicate Records

Posted By:Santosh       Posted Date: October 27, 2010    Points: 15    Category:    URL: http://www.dotnetspark.com  

This query will ignore the duplicate records between two tables............... Ex:if table1 (column1,column1,column1) column values is same with table2(column1,column2,column3) column values and column values should be integer type,then this will give u one result....
 

Query to ignore duplicate record between two tables....
the comparision columns should be integer....


SELECT   SH.ID,SH.PALLETNO 'Pallet No',SH.SLIPNO 'Slip No',SH.SLIPCOUNT 'Slip Count',MO.MONO,WDH.STLACCPC 'STLACCPC',WDH.WEIGHINGID FROM WH_SCRAPHISTORY SH       
INNER JOIN SL_MILLORDER MO ON MO.ID = SH.MILLORDERID       
INNER JOIN WH_WEIGHINGDTLS_HST WDH ON WDH.ID = SH.WEIGHINGDTLSID       
WHERE      
 CONVERT(VARCHAR,SH.PALLETNO) + CONVERT(VARCHAR,SH.SLIPno)  NOT IN       
(      
SELECT CONVERT(VARCHAR,WD.PALLETNO) + CONVERT(VARCHAR,WD.SLIPno)  FROM WH_WEIGHINGDTLS WD      
INNER JOIN WH_WEIGHING W ON W.ID =  WD.WEIGHINGID  WHERE W.MILLORDERID = @MOID          
)      



Regards
Santosh

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend