Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 tamilarasu
		
			tamilarasu
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi,
I have two tables and one is source data and another one is revised. I want to replace the source data with the revised data. Can any one suggest me a data model for this scenario.
Sample data attached.
Also, Is it possible to show the source records which are not available in revised table.
thank you
Regards,
Tamil
 
					
				
		
 jagan
		
			jagan
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi,
Try like this
Data:
LOAD
*
FROM Table2;
Concatenate(Data)
LOAD
*
FROM Table1
WHERE Not Exists(Cust);
Hope this helps you.
Regards,
Jagan.
 
					
				
		
 jagan
		
			jagan
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi,
Try like this
Data:
LOAD
*
FROM Table2;
Concatenate(Data)
LOAD
*
FROM Table1
WHERE Not Exists(Cust);
Hope this helps you.
Regards,
Jagan.
 
					
				
		
with only one sql query:
DATA:LOAD *;
SQL SELECT x.Cust as Cust,x.Prod as Prod,x.Type as Type,y.Price
from Table1 x,Table2 y
where x.cust=y.cust and x.Prod=y.Prod and x.Type=y.Type
union all
SELECT x.Cust as Cust,x.Prod as Prod,x.Type as Type,y.Price
from Table1 x where not exists(select * from Table2 y
where x.cust=y.cust and x.Prod=y.Prod and and x.Type=y.Type)
order by x.Cust,x.Prod,x.Type;
 
					
				
		
 vinay_hg
		
			vinay_hg
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi try Applymap from second table to first table, and use if condition, if matches then applymap result else use the same result from A table.
"if(table1.key=table2.key, applymap( from table 2 to table 1 to get price), table1.price)as price " in table 3 price column.
 tamilarasu
		
			tamilarasu
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Thank you Jagan, Antonio and Vinaykumar. 
