OK, apparently I am going to have to re-write most of the script now because of your suggestion. This is a good thing though because I was able to get the MySQL data into a nicely formatted, comma-delimited csv file.
This is the select statement I used, if anyone is wondering:
SELECT Employee.username, Employee.first_name, Employee.last_name, Dep
+artment.name, LocationBuilding.name, PhoneNumbers.phone_id, PhoneNumb
+ers.fax_flag, PhoneNumbers.exchange, P.position, OrgChart.supervisor_
+id FROM P INNER JOIN OrgChart ON(P.employee_id=OrgChart.employee_id)
+INNER JOIN Employee ON(OrgChart.employee_id=Employee.employee_id) INN
+ER JOIN PhoneNumbers ON(Employee.employee_id=PhoneNumbers.employee_id
+) INNER JOIN Department ON(OrgChart.department_id=Department.departme
+nt_id) INNER JOIN LocationBuilding ON(Department.building_id=Location
+Building.building_id) INNER JOIN Location ON(LocationBuilding.buildin
+g_id=Location.building_id) INNER JOIN LocationRooms ON(Location.room_
+id=LocationRooms.room_id);" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g'
+> Employee.csv
Thanks! |