sql - how to work with Derived Tables -
i trying understand derived tables kinda have idea still messing it. did code dont think right. don't know if have input wrong or left out. table working distinct company name customers table orders have higher discount than.2.i have been looking on maybe have of names backwards or something.
select distinct c.companyname customers c join (select orderid orders o join [order details] od on c.customers = od.orderid od.orderid = '<.2'
the last part not working the.2
how columns set in northwind database click on tables , go down see dbo.order details , click on columns find orderid, productid, unitprice, quantity, disounts. have custumers table had customerid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, , fax. if go under order table have orderid, customerid, employeeid, orderdate, requireddate, shippeddate,shipvia, frieght, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry.
something should it.
select c.companyname customers c exists(select null orders o inner join [order details] od on o.orderid = od.orderid , od.discount > .2 o.customerid = c.customerid)
Comments
Post a Comment