How to select columns that are from different tables SQL -
i have table named items , table named orders. orders table need select artists column , orders table need select order_date , ship_date; how can this?
in selecting columns in different tables can use join, left join, or right join connect 2 tables. in doing need 1 same column in both of tables.
join
select table1.colmun_name, table2.column_name table1_name table1 join table2_name table2 on table1.primarykey = table2.table1_primarykey
for example:
select items.artists, order.order_date, order.ship_date items items left join orders order on item.item_id=order.item_id
item_id
common column in table1
, table2
2 tables can connect each other.
edit: changed table name
as ^ need elaborate question clear want because can put changed table name in query.
Comments
Post a Comment