「SQL」内部結合inner joinのサンプル
書式
select
カラム名
from テーブルA
inner join テーブルB
on
条件式
where
条件式
select
カラム名
from テーブルA
inner join テーブルB
on
条件式
where
条件式
select カラム名 from テーブルA inner join テーブルB on 条件式 where 条件式
使用例
select
ta.orderid
, tb.customername
from
orders ta
inner join customers tb
on ta.customerid = tb.customerid
where tb.customername like 'Tr%'
select
ta.orderid
, tb.customername
from
orders ta
inner join customers tb
on ta.customerid = tb.customerid
where tb.customername like 'Tr%'
select ta.orderid , tb.customername from orders ta inner join customers tb on ta.customerid = tb.customerid where tb.customername like 'Tr%'
結果
OrderID | CustomerName |
---|---|
10249 | Tradição Hipermercados |