tsql - T-SQL filter on external join -


using schema below, write query lists total value of sales customers bought item sales person same middle initial them. query should return single result.

the quantity , price columns both ints. sales - employee link on employeeid - salespersonid. enter image description here

something should work:

select sum(s.quantity * p.price) totalsales sales s join products p on s.productid = p.productid join customers c on s.customerid = c.customerid join empleyees e on s.salespersonid = e.employeeid c.middleinitial = e.middleinitial 

Comments

Popular posts from this blog

html - height not adding height to a empty div -

Oracle SQL. How to select specific IDs where value of columns specify criteria? -

python - Robot Framework location and name of keyword -