| Author |
Topic |
|
sqlnewcomer
Starting Member
2 Posts |
Posted - 2011-03-08 : 03:38:18
|
| I have Multiple tables, tbl_employee w/ empid, fname, lname; tbl_customer w/ custid, fname, lname; tbl_order w/ orderid, custid, empid, order_date; tbl_lineitem w/ orderid, prodid, quantity; tbl_product w/ prodid, descript, list_price;I want to Query information with order by Order_date, orderid, customer's fname & lname, employee's fname & lname, descript, list_price, quantity, |
|
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2011-03-08 : 03:51:24
|
| Looks like homework.Hint: Join tbl_customer with Order on custidJoin tbl_product with order on prodidJoin tbl_lineitem with Order on OrderID and with product on Prodid. |
 |
|
|
sqlnewcomer
Starting Member
2 Posts |
Posted - 2011-03-08 : 10:42:50
|
| This is what I have for my query so forselect a.orderid, a.custid, a.empid, a.order_date, a.delivery, a.payment_type, b.lineitemid, b.orderid, b.prodid, b.quantity, b.sale_pricefrom [order] a, lineitem bwhere a.orderid = b.orderidBut i want the names of emloyees and customers. |
 |
|
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2011-03-08 : 10:53:47
|
| something to start with:select a.orderid, a.custid, a.empid, a.order_date, a.delivery, a.payment_type,b.lineitemid, b.prodid, b.quantity, b.sale_price,c.fname, c.lname from tbl_customer c inner join [order] a on c.CustId = a.custid inner join tbl_product tp on tp.prodid = a.prodidinner join lineitem b on b.orderid = a.orderid and tp.prodid = b.prodidNote: No testing carried out.If you get any syntax error try to do it yourself. It will help you in learning. |
 |
|
|
|
|
|