Jump to content

How to Insert this?


grafixart

Recommended Posts

I want to insert into a table called hre_cat

The already existing fields are:

id, parent_id, title, name, alias, image, section, image_position,

description, published, checked_out_time, editor, ordering, access,

count, params

 

For each record already

existing, I want to insert a new record that takes it's id from the id field for each existing record and puts it into the parent_id field. So the id field for each new record has to start at 36703 and go to 73406 (36703+1...73406), the parent_id field has to go from 1-36703, and the section

field needs to be equal to the section field of the parent (an integer).

 

How would I phrase this in an insert command? Do I need to use php?

 

Can anyone help?

Thanks!

Link to comment
Share on other sites

No, the existing records are only up until 36703

so (36703+1,2,3...73406) would be new for ID

and then for the parent_id it would list #s from 1-36703.

 

Do you understand?

How would I write this using an insert command? I want to insert multiple records at once using a formula. New to sql.

 

Thanks!

Link to comment
Share on other sites

Yes, the id column is set to auto increment.

I know how to do a basic insert statement. What I need to understand is how to phrase this in the insert statement:

 

"the parent_id field has to go from 1-36703, and the section

field needs to be equal to the section field of the parent (an integer)".

 

Any help you could give would be appreciated!

Thanks!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.