Hi,
I am tring to do a select from 2 tables.
Table1:
sku
title
Table 2:
sku
feature
SELECT table1.title, table2.feature FROM table1,
table2 WHERE table1.sku in ($sku1, $sku2, $sku3) ORDER
BY FIELD(table1.sku, $sku1, $sku2, $sku3) ASC
That seems to work to some extint, but I am getting
way too many results (more than 3). It's returning
all combinations of sku and feauture even if they
don't share the same sku.
I modified the select to:
SELECT table1.title, table2.feature FROM table1,
table2 WHERE (table1.sku = $table2.sku) AND table1.sku
in ($sku1, $sku2, $sku3) ORDER BY FIELD(table1.sku,
$sku1, $sku2, $sku3) ASC
That seemed to work almost correctly. I have some
items in table2 that don't have a feature and therefor
don't have a row associated with them.
For example, if I have 3 items in each table, the
above select works fine.
If I have 3 items in table1 and 2 items in table2 the
above query only gives me 2 results.
table1 will always be fully populated and table2 might
be missing some features.
How can I run my query to get 3 results and if the
feature is missing still return the table.title and
NULL for the feature?
Thanks,
Grant
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]