iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Database Discussion Forum This is the place to find help resolving those nagging questions you have about implementing and using all kinds of databases. Need help writing a query? Need an opinion on Oracle? Post here!

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-31-2009, 09:09 PM
WebProWorld Pro
 
Join Date: Jul 2003
Location: Canada
Posts: 272
ackerley1 RepRank 0
Default Add unique value to All product_model Fields

Hello, maybe someone on this forum can help me solve this issue.

I posted this on the OSComm forusm:

Adding Model Number via MySQL - osCommerce Community Support Forums

Essentially need to populate the product_model field with a unique numerical value.

Is there a MySQL DB query I can run that will do this for me?

Any help would be appreciated.

Rob
Reply With Quote
  #2 (permalink)  
Old 07-31-2009, 10:03 PM
Uncle Dog's Avatar
WebProWorld Pro
 
Join Date: Apr 2008
Location: Scotland
Posts: 254
Uncle Dog RepRank 5Uncle Dog RepRank 5Uncle Dog RepRank 5Uncle Dog RepRank 5Uncle Dog RepRank 5Uncle Dog RepRank 5
Default Re: Add unique value to All product_model Fields

Assuming you've already ALTERed your table

UPDATE name of table in quotes SET 'product_model' = name of record id in quotes;
...should work but surely you could just reference the record id directly.
Reply With Quote
  #3 (permalink)  
Old 08-01-2009, 12:17 PM
WebProWorld Pro
 
Join Date: Jul 2003
Location: Canada
Posts: 272
ackerley1 RepRank 0
Default Re: Add unique value to All product_model Fields

What you have listed appears to work for 1 item, but not for all of them.

Is it possible to copy values from one column (product_id) to another column (product_model)? But do it across all 2600 products in the dB?

Thanks!
__________________
Rob
Reply With Quote
  #4 (permalink)  
Old 08-01-2009, 06:09 PM
Uncle Dog's Avatar
WebProWorld Pro
 
Join Date: Apr 2008
Location: Scotland
Posts: 254
Uncle Dog RepRank 5Uncle Dog RepRank 5Uncle Dog RepRank 5Uncle Dog RepRank 5Uncle Dog RepRank 5Uncle Dog RepRank 5
Default Re: Add unique value to All product_model Fields

UPDATE ? SET ? = ? should work through every record in the table.
Reply With Quote
  #5 (permalink)  
Old 08-01-2009, 06:22 PM
WebProWorld Pro
 
Join Date: Jul 2003
Location: Canada
Posts: 272
ackerley1 RepRank 0
Default Re: Add unique value to All product_model Fields

Sorry my MySQL is not very extensive:

UPDATE product_table SET product_model = ???

Would I have to do that query for every single line (2600 of them?) or would that update each of them with a unique value?
__________________
Rob
Reply With Quote
  #6 (permalink)  
Old 08-01-2009, 06:25 PM
Uncle Dog's Avatar
WebProWorld Pro
 
Join Date: Apr 2008
Location: Scotland
Posts: 254
Uncle Dog RepRank 5Uncle Dog RepRank 5Uncle Dog RepRank 5Uncle Dog RepRank 5Uncle Dog RepRank 5Uncle Dog RepRank 5
Default Re: Add unique value to All product_model Fields

No.

Apologies. I've just tested my post. The MySQL statement should be

UPDATE product_table SET product_model = product_id;

Do this once and it will alter all records.

Last edited by Uncle Dog; 08-01-2009 at 06:45 PM.
Reply With Quote
  #7 (permalink)  
Old 08-01-2009, 06:38 PM
WebProWorld Pro
 
Join Date: Jul 2003
Location: Canada
Posts: 272
ackerley1 RepRank 0
Default Re: Add unique value to All product_model Fields

okay... I will give it a try... after back up of course!
__________________
Rob
Reply With Quote
  #8 (permalink)  
Old 08-01-2009, 06:55 PM
WebProWorld Pro
 
Join Date: Jul 2003
Location: Canada
Posts: 272
ackerley1 RepRank 0
Default Re: Add unique value to All product_model Fields

it worked.. now to figure out why Easy Populate contrib for OS Comm still won't work...

thanks for help...

Rob
__________________
Rob
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Sticky fields overflo Web Programming Discussion Forum 5 11-13-2008 05:09 AM
Need Your Eyes - Puzzle Table Fields freetraff Graphics & Design Discussion Forum 1 12-10-2007 07:35 PM
Name of file relevant in some non competitive fields begabloomers Search Engine Optimization Forum 0 09-04-2006 03:11 PM
Mandatory fields in a form (formmail) aventvoy Web Programming Discussion Forum 4 11-17-2005 01:45 AM
cannot get 12 fields back, only 3 bufhal Database Discussion Forum 9 05-11-2004 05:14 PM


All times are GMT -4. The time now is 04:43 AM.



Search Engine Optimization by vBSEO 3.3.0