Welcome Guest, Not a member yet? Register   Sign In
How would you solve this? Some data in csv, some in mysql
#2

[eluser]kgill[/eluser]
The most efficient solution would be to load the CSV data into its own table in the database, then when you query the table with the prices, you can join the two tables and get the PDF name as part of your query instead of messing with reading a file, parsing each line and building an array. It's data and you want to query it, why would you keep it outside of the database if you're already using the DB in the app?

While you don't have to do it, ideally you'd want to use an ID number instead of the manufacturer's name as the primary key, auto numbering the new table will give you that much, the only issue is getting those numbers into the other table and that's easily taken care of with a new column and an update statement.

Code:
update pt set pt.manufacturer_id = mf.ID
FROM price_table as pt
LEFT JOIN manufacturers as mf on mf.name = pt.manufacturer_name

After that drop the manufacturers name column from the price table as that data is sitting in your other table.


Messages In This Thread
How would you solve this? Some data in csv, some in mysql - by El Forum - 07-06-2009, 01:41 PM



Theme © iAndrew 2016 - Forum software by © MyBB