Jump to content

INSER INTO SELECT troubles


wookie

Recommended Posts

I want to select a whole column (from one table) and copy the results into one field in another table, I've tried using "INSERT INTO/SELECT" but this just creates many new rows in the second table, and I want it into one field...can this be done?

 

Many thanks!

 

Wookie

Link to comment
Share on other sites

Its likely you need to specify a WHERE clause. Can we see your query?

 

Sure you can..

 

$query1 = mysql_query("INSERT INTO stev1965_smf14.listing (topl) SELECT url FROM stev1965_smf14.details WHERE position = 0") or die("Error: ".mysql_error());

 

The above query makes many new rows, each with a "url" in the collumn "topl", I need all the url's to be in one field in one row if its possible.

 

Regards

 

Wookie

Link to comment
Share on other sites

The third party script I'm using is an autopost script that posts to a forum, this script can only run one query and post its results, hence why I'm making another table and condensing results to that. This is why I require all the urls in one field on one row.

HTH

 

Wookie

Link to comment
Share on other sites

this script can only run one query and post its results

 

Surely you can alter this script do perform more than 1 query. I think i'm also missing the point when you're saying you need all this information in 1 row. You're making a post to a forum, i figured that, but how is this "post" being processed? This 3rd party script is doing what? Connecting to your DB and querying for information? Are you giving it a string? Does it take a string? Are you executing any SQL yourself?

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.