Solved

Help with Import Wizard

Posted on 2011-09-06
6
390 Views
Last Modified: 2012-05-12
OK....I have a table for my Products called "tblProduct".

That product has a column called 'SKU'.  I have added the column 'List_Price'

I have an Excel Spreadsheet that has two columns.  column 1 is SKU column 2 is list_price.

Can I use the import wizard to UPDATE the product table, but ONLY the column 'list_price' based on a where clause for the SKU field?

I've tried walking through the wizard, but I wasn't sure how to do that.

Please help

Thanks!
0
Comment
Question by:DCFC
  • 3
  • 2
6 Comments
 

Author Comment

by:DCFC
ID: 36492645
Yes, MySQL, not MS SQL Server.

0
 
LVL 59

Accepted Solution

by:
Kevin Cross earned 500 total points
ID: 36492691
Sorry for the silly question. I am just use to mysqldbimport (or mysqlimport), which is a command line tool. However, navicat, EMS, and SQLMaestro provide import wizards, so maybe you are using one of them. Moving along to your question, I suspect that in any case the import is not conditional. You may need to import to a staging table and then from there use an UPDATE with a JOIN or use the REPLACE (or INSERT INTO ... ON DUPLICATE KEY) SQL syntax to accomplish what you want.
0
 

Author Comment

by:DCFC
ID: 36492723
Oh....OK, I can import to a staging table....but how would I write the UPDATE statement on the join?  Can you give me an example?
0
 
LVL 59

Assisted Solution

by:Kevin Cross
Kevin Cross earned 500 total points
ID: 36492828
No problem.

Say your staging table is tblProducts_Import with same structure as tblProducts, then you can do something like in the attached snippet(s).

UPDATE tblProduct AS tto, tblProducts_Import AS tfr
SET tto.list_price = tfr.list_price
WHERE tto.SKU = tfr.SKU
;

Open in new window


Or with ANSI join...
UPDATE tblProduct AS tto
JOIN tblProducts_Import AS tfr ON tto.SKU = tfr.SKU 
SET tto.list_price = tfr.list_price
;

Open in new window


Hope that helps!
0
 

Author Closing Comment

by:DCFC
ID: 36495970
Thanks so much for your help!  That worked perfect!  I imported to the staging table and then ran the update statement!  Thanks so much!
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
First name pregmatch 11 39
simple mysql statement 3 40
Present Absent from working date rage 11 21
how to access a remote mysql database with xampp 3 10
Fore-Foreword Today (2016) Maxmind has a new approach to the distribution of its data sets.  This article may be obsolete.  Instead of using the examples here, have a look at the MaxMind API (https://www.maxmind.com/en/geolite2-developer-package). …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question