I've got two tables. One with part numbers, hardware names, and type and other with the locations of the hardware that also has locations of specific bins that contain the hardware. The bins don't have a specific number but have unique names. The second table also has the location of the hardware and bin which may change over time. And I'm trying to create a MySQL query that will combine the data in a new table that will be outputted as a comma separated file.
Table 1 Contents
Part Number | Name | Type
------------+---------------+---------------
0 | None | Not Applicable
25 | name1 | type1
150 | name2 | type2
Table 2 Contents
Date | Bin | Part Number | Event | To Location | From Location
---------+------+--------------+----------+-------------+---------------
1/1/2013 | bin1 | 0 | arrive | location1 | none
1/2/2013 | none | 25 | arrive | location2 | none
1/2/2013 | none | 150 | relocate | location3 | location2
The final output of the query should look something like:
Date | Bin | Part Number | Part Name | Type | Event | To Location | From Location
---------+------+-------------+-----------+----------------+----------+-------------+--------------
1/1/2013 | bin1 | 0 | None | Not Applicable | arrive | location1 | none
1/2/2013 | none | 25 | name1 | type1 | arrive | location2 | none
1/2/2013 | none | 150 | name2 | type2 | relocate | location2 | location2
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…