I'm new to SQL and need help with a select statement. I have 2 tables one called item and the other called item_unit. I need to select all items, there is one record per item. And also select 1 field from the item unit file for each item. There can be 1 to 3 records for each item in the item_unit file. The link to the 2 files is item_number. I need one row returned for each item. Below is an example of what my files look like:
Item file:
Item_number Description
11111 Candy bar 1
11121 Candy bar 2
12332 Snack bar
Item_unit File:
Item_number Unit
11111 CS
11111 Box
11111 EA
11121 CS
11121 EA
12332 CS
I want my results set to look like this:
Item_number Unit1 Unit2 Unit3
11111 CS Box EA
11121 CS EA <null>
12332 CS <null> <null>
The item and item_unit files contain many more fields than I have described. I'm just trying to simplify my question. Any suggestions?
Item file:
Item_number Description
11111 Candy bar 1
11121 Candy bar 2
12332 Snack bar
Item_unit File:
Item_number Unit
11111 CS
11111 Box
11111 EA
11121 CS
11121 EA
12332 CS
I want my results set to look like this:
Item_number Unit1 Unit2 Unit3
11111 CS Box EA
11121 CS EA <null>
12332 CS <null> <null>
The item and item_unit files contain many more fields than I have described. I'm just trying to simplify my question. Any suggestions?