Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Suppose we have:

CREATE TABLE cscart_products_prices_temp LIKE cscart_products_prices;
ALTER TABLE `cscart_products_prices_temp`
  DROP `percentage_discount`,
  DROP `lower_limit`,

LOAD DATA LOCAL INFILE '/home/thehouse/public_html/sarah/prices.csv' 
INTO TABLE cscart_products_prices_temp 
FIELDS TERMINATED BY ',' 
IGNORE 1 LINES
(product_id, price, usergroup_id);

UPDATE cscart_products_prices_temp B
INNER JOIN cscart_products_prices A USING (product_id) 
SET A.price = B.price;

DROP TABLE cscart_products_temp_prices;

QUESTION:

In the scenario where product_id is not unique BUT the combination of BOTH product_id and another field called "usergroup_id " is unique, how can I include usergroup_id?

WOULD a statement like this be correct? :

INNER JOIN cscart_products_prices A USING (product_id,usergroup_id)  
share|improve this question
4  
What happened when you tried? –  a_horse_with_no_name Apr 23 '13 at 12:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.