Newbie in need of serious help

Codes here !

Moderators: egami, macek, gesf

Post Reply
Elena Mitovska
New php-forum User
New php-forum User
Posts: 13
Joined: Tue Nov 12, 2002 12:11 pm
Location: Ukraine

Sun Nov 17, 2002 11:02 pm

To retrive data from 2 table by one select query you eed to use LEFT OUTER JOIN or INNER JOIN constractuins of MySQL.
If every record in yuor Product table has its match in Supplier table use INNER JOIN, if it doesn't use LEFT OUTER JOIN. INNER JOIN fetches only those records that has its math in other table (matched by SupID)
For example, this quiery retrives information about both Product and Supplier from both tables:

Select distinct P.*, S.* from Products P LEFT OUTER JOIN Supplier S ON P.SupID=S.SupID WHERE P.SupID=......

Hope it helps :)
best regards,
Elena Mitovska,
AlarIt company

Post Reply