vBulletin

Thank you for visiting. This is our website archive. Please visit our main website by clicking the banner above.
vBulletin FAQ is dedicated to helping the forum owner build, manage and profit from his vBulletin Forum
vBulletin Web Hosting - Free skins and styles for your vBulletin - Search Engine Optimization




Selecting fields from multiple tables

que
08-12-2006, 05:40 PM
Hi,

If you have a few tables.

table 1 - products: [Code, prodCode, supplierNumber]
table 2 - suppliers: [code, name]
table 3 - types: [code, name]

How do you select a few fields from the let's say 3 tables, where products.typeCode = types.code, products.supplierCode = suppliers.code .........

Thanks

Gadabout
09-12-2006, 10:49 AM
select products.code, products.prodcode, products.suppliernumber, suppliers.name as suppliername, types.name as typesname
from products
LEFT JOIN suppliers AS suppliers ON(suppliers.code = products.code)
LEFT JOIN types AS types ON(types.code = products.code)


vBulletin

seo book

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum