Akhter HUssain

Akhter HUssain

  • 712
  • 1.3k
  • 103.3k

Require Select query ?

Feb 3 2020 2:06 AM
i want select join query below is data ,
my requirement is that ,i want to display balesize from itemmasterfile and Probale table,
if balesize exit in Probale table then take balesize  from Probale table ,if bale size in Probale table is null then it will take from itemmaster file   ,
 
 
  1. CREATE TABLE #ItemMasterFile(CodeItem INT,Descriptionitem VARCHAR(50),Balesize varchar(50))    
  2.   
  3. CREATE TABLE #Probale(BID INT,CodeItem INT,prdQTY INT,Entrydate DATETIME,Balesize varchar(50))    
  4. INSERT INTO #ItemMasterFile VALUES(1,'A','100lbs')    
  5. INSERT INTO #ItemMasterFile VALUES(2,'B','100lbs')    
  6. INSERT INTO #ItemMasterFile VALUES(3,'C','100lbs')    
  7. INSERT INTO #ItemMasterFile VALUES(4,'D','100lbs')    
  8. INSERT INTO #ItemMasterFile VALUES(5,'e','100lbs')    
  9. INSERT INTO #ItemMasterFile VALUES(6,'f','100lbs')    
  10. INSERT INTO #ItemMasterFile VALUES(7,'g','100lbs')    
  11. INSERT INTO #ItemMasterFile VALUES(8,'h','100lbs')    
  12. INSERT INTO #ItemMasterFile VALUES(9,'K','100lbs')    
  13. INSERT INTO #ItemMasterFile VALUES(10,'L','100lbs')    
  14. INSERT INTO #ItemMasterFile VALUES(11,'M','100lbs')   
  15.   
  16. INSERT INTO #Probale VALUES(10011,1,1,'01-06-2019',null)    
  17. INSERT INTO #Probale VALUES(10012,3,1,'02-06-2019',null)    
  18. INSERT INTO #Probale VALUES(10013,11,1,'03-06-2019',null)    
  19. INSERT INTO #Probale VALUES(10014,10,1,'08-06-2019',null)    
  20. INSERT INTO #Probale VALUES(10015,8,1,'03-06-2019','150 lbs')    
  21. INSERT INTO #Probale VALUES(10016,9,1,'08-06-2019','150 lbs')    
  22. INSERT INTO #Probale VALUES(10017,9,1,'08-06-2019','150 lbs')    
 

Answers (2)