Help with sql query

I am a complete newbie at this and really do not know sql. I am just stumbling around but have completed a few queries with success. I have a field in a table that I want to APPEND information to, specifically the text " 7" (Without the quotes) I am using this:

INSERT INTO jos_vm_product product_sku VALUES ' 7'

But I keep getting an error.

I am using phpMyAdmin

Can anyone offer some help here. This would save me hours of work.

Many thanks,
Houston

Try

INSERT INTO jos_vm_product (product_sku) VALUES (7)

I got this error:

You have an error in your SQL syntax; check the manual that corresponds  to your MySQL server version for the right syntax to use near 'RT INTO  jos_vm_product (product_sku) VALUES (7)' at line 1

This is the syntax

INSERT INTO TABLENAME (COLOUMNAME) VALUES (VALUES)

try
INSERT INTO jos_vm_product (product_sku) VALUES (‘7’)

are yu sure the table name is correct

That worked but instead of appending a field in a record it added a whole new record. The filed product_sku was set to 7 and all other fields to NULL. Not was I was wanting to do.

then u must use update statement

Update tablename set coloumname=value

Wont this replace what is there? I just need it to append to what is already in the field

then you should use concatenate for that particular coloumn and row

update tablename set coloumname=concat(coloumname, ‘7’) where id=‘1’;

id is the primary key

I did a slight modification but it worked. Many many thanks for your help.

update jos_vm_product set product_sku=concat(product_sku, ' 7') where product_id>'106'

I have another thing I am wanting to accomplish it will make a lot more sense to do it using queries than doing through the Virtuemart interface. I have a client that wants to show 50 stone sizes and instead of just putting in all the stones once and using an option to choose one of the four sizes to order, he wants to show 50 stones in a 7mm category, 50 stones in a 8mm category, 50 stones in a 10mm category, 50 stones in a 12mm category. I advised against it but he is insistent. So now since I do not want to enter 150 stones back into the database using the VM admin, I figured there is some way to insert a copy each of the stones back into the database using a query. So basically there will be four of each kind and then I will go back and add 7mm, 8mm, 10mm, and 12mm to the end of the names to show the difference.

Any suggestions on how I would do that?

Cheers,
Houston

Glad it helped, can you ask your second question in a seperate thread