join - SQL Query different value from same column -
was required query data tables products
, customers
. expected results below:
cust_name(from) | product_name | product_desc | eta | cust_name(to)
the cust_name(from)
, cust_name(to)
both same table (customers
). how query sql statement query 2 different value column?
you need join customer
twice on table products
because there 2 columns dependent on it,
select b.name custnamefrom, a.product_name, a.product_desc, a.eta, c.name custnameto products inner join customer b on a.cust_from = b.id inner join customer c on a.cust_to = c.id
to further gain more knowledge joins, kindly visit link below:
Comments
Post a Comment