Let's say I have the following three tables:
WIDGETS
id name 1 ABC Widget 2 XYZ Widget
ATTRIBUTES
id name 1 Color 2 Size 3 Weight
WIDGET_ATTRIBUTES
widget_id attribute_id value 1 1 Red 1 2 Small 2 1 Blue 2 2 Large 2 3 5 Pounds
Is there an easy way to select all widgets and their associated attributes, one widget per returned row? Example results:
widget_id widget_name Color Size Weight 1 ABC Widget Red Small NULL 2 XYZ Widget Blue Large 5 Pounds
You'll note that widget #1 does not have a weight specified, so NULL would be returned (or blank, whatever).
Perhaps it's because today is Friday, but I can't think of how to do this?!?



Reply With Quote





Bookmarks