a mysql join
ties 2 tables.
shows all of stockbook, and using a non-descriptive index within stockbook table i.e a number, it displays the more descriptive column from the other table
This works even if the relationship is not enabled, but enabling the relationship prevents incorrect entries by forcing integrity with the drop down list
SELECT `stockbook`.*, `categories`.`type`
FROM stockbook, categories WHERE `stockbook`.`categories` = `categories`.`category_id`
example from
http://www.tizag.com/mysqlTutorial/mysqljoins.php
and statement and ordering with AS command for column ambiguity resolution
SELECT `stockbook`.*, `categories`.`type`,`locations`.`notes` AS 'Location Notes'
FROM stockbook, categories,locations WHERE `stockbook`.`categories` = `categories`.`category_id` && `stockbook`.`location` = `locations`.`location_id` ORDER BY `stockbook`.`product_id`
No comments:
Post a Comment