Jump to content

Loop through all results in table and find out which ones are appropriate


mds1256

Recommended Posts

Hi

 

I am working on a little hobby and it requires a script to go through all results in a table (potentially 10's of thousands) and get the id of all rows that are relevant to that query. So for example get all ID's where the category is set to 'Computers'.

 

Once it has retrieved all the ID's for the suitable category it then needs to insert some data into a different table, e.g. the ID that it has previously retrieved along with some details (the same details for each ID, so many rows with the same details but the ID being different).

 

Now, which is the best way to achieve this. Should I do this in a PHP script, shell script or a database stored procedure?

 

Which way would be faster as I believe this could take a long time or am I wrong.

 

When a user submits a form that will insert these details into one table and then kick off a background task (as waiting for the above to run will take a while or am I wrong).

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.