Hi Friend i want to merge two tables here is my table....
table 1
Brand TotalStock Transferred date
xxx 100 50 06/03/2014
yyy 100 50 06/03/2014
table 2
Brand Transferred available date
xxx 50 48 06/03/2014
yyy 50 40 06/03/2014
Result Table:
Brand TotalStock Transferred available date
xxx 100 50 48 06/03/2014
yyy 100 50 40 06/03/2014
Result table should be based Date.Can anyone help me out.
Loading


Jignesh TrivediRank #16 · 50.3K reputationPosted Mar 5, 2014, 11:26 PM EST
if the relation between table1 and table2 is Brand than agree with Ayin Rivera
other wise you have add more column in join
like
Select
t1.Brand, t1.TotalStock, t1.Transferred, t2.available, t1.date
from Table1 t1
join Table2 t2 on t1.Brand = t2.Brand and t1.Date = t2.Date
hope this will help you.
Ayin Rivera30 reputationPosted Mar 5, 2014, 10:57 PM EST
Try this:
Select
t1.Brand, t1.TotalStock, t1.Transferred, t2.available, t1.date
from Table1 t1
join Table2 t2 on t1.Brand = t2.Brand
selva kumarRank #2,987 · 483 reputationPosted Mar 5, 2014, 11:29 PM EST
suraj ghosi30 reputationPosted Mar 6, 2014, 12:22 AM EST
t1.Brand, t1.TotalStock, t1.Transferred, t2.available, t1.date
from Table1 t1
join Table2 t2 on t1.Brand = t2.Brand and t1.Date = t2.Date
Ehtesham MehmoodRank #719 · 3.3K reputationPosted Mar 6, 2014, 12:34 AM EST
http://developers.cartodb.com/tutorials/joining_data.html