Hi Fongo, Steve gave a perfect explanation ( and made me realize my and Egor's small mistake ;-)
2003年 8月 15日 金曜日 17:08、Nils Valentin さんは書きました: > Hi Fongo, > > http://www.mysql.com/doc/en/JOIN.html > > > Should work like this (untested): > > SELECT Customers.Name, Customers.City, Orders.Product, Order.Price from > Customers, Orders WHERE Customers.cust_id = Orders.cust_id AND > cust_id = 2 inner join SELECT Customers.Name, Customers.City, Orders.Product, Orders.Price from Customers, Orders WHERE Customers.cust_id = Orders.cust_id AND customers.cust_id = 2; So you have 3 possibilities (1 above and 2 below ): SELECT Customers.Name, Customers.City, Orders.Product, Orders.Price FROM Customers inner join Orders ON customers.cust_id=Orders.cust_id WHERE customers.cust_id = 2; SELECT Customers.Name, Customers.City, Orders.Product, Orders.Price FROM Customers inner join Orders USING (cust_id) WHERE customers.cust_id = 2; That should wrap it up nicely ;-). Best regards Nils Valentin Tokyo/Japan > 2003年 8月 15日 金曜日 16:44、B. Fongo さんは書きました: > > Hello! > > > > I ' m trying to extra some information from 2 tables using inner join, > > but receive an error warning. Am newbie so I' m not able to feature out > > why my queries don't work. > > > > Scenario: > > > > I have 2 tables: Customers and orders. The have following structures: > > Customers Orders > > cust_id Product > > Name Price > > City cust_id > > > > > > All that am trying to get out of these tables is to use a cust_id of a > > given customer to extract their orders. So I use something like this: > > > > SELECT Customers.Name, Customers.City, Orders.Product, Order.Price from > > Customers WHERE cust_id = 2 inner join Orders ON Customers.cust_id = > > Orders.cust_id > > > > Can anyone help me on this? > > > > Thanks > > -- > --- > Valentin Nils > Internet Technology > > E-Mail: [EMAIL PROTECTED] > URL: http://www.knowd.co.jp > Personal URL: http://www.knowd.co.jp/staff/nils -- --- Valentin Nils Internet Technology E-Mail: [EMAIL PROTECTED] URL: http://www.knowd.co.jp Personal URL: http://www.knowd.co.jp/staff/nils -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]