find sold subscriptions from table 1 and store name in table 2, joined by store id. (oracle) I am trying to get the number of sold subscriptions from one table and the store name from another. The tables have a common column containing a store id, however the columns do not have the same name. 

Talbe1                  |   Table2

Amount     store_code   |   store_name    store_no

1          nf1ii        |   Jims kiosk    nf1ii
1          nfoi1        |   Henrys kiosk  nfoi1
...        ...          |   ...           ...


I am trying to count the number of subscriptions sold for each store name. How is this doen in Oracle? I am fairly new to SQL in general so please forgive me if the question is phrased strangely.
select 
t2.store_name 
,t1.store_code
,sum (t1.Amount) -- if Amount can be &gt;1
,count (t1.*)  -- if counting rows is enough and we want to show stores without subscribtions
from Table1 t1
right join Table2 t2 on t1.store_code=t2.store_code
where
t1.subs = 'twin' /* type of subscription */
and t1.date &gt; '01.05.13'
group by t2.store_name, t1.store_code


It is a good practice to use LEFT JOIN rather then RIGHT JOIN, as the later one is harder to imagine and understand.

select 
t1.store_name 
,t2.store_code
,sum (t2.Amount) -- if Amount can be &gt;1
,count (t2.*)  -- if counting rows is enough and we want to show stores without subscribtions
from Table2 t1
left join Table1 t2 on t1.store_code=t2.store_code
where
t2.subs = 'twin' /* type of subscription */
and t2.date &gt; '01.05.13'
group by t1.store_name, t2.store_code