wookie Posted March 17, 2008 Share Posted March 17, 2008 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 Quote Link to comment Share on other sites More sharing options...
trq Posted March 17, 2008 Share Posted March 17, 2008 Its likely you need to specify a WHERE clause. Can we see your query? Quote Link to comment Share on other sites More sharing options...
wookie Posted March 17, 2008 Author Share Posted March 17, 2008 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 Quote Link to comment Share on other sites More sharing options...
fenway Posted March 17, 2008 Share Posted March 17, 2008 I need all the url's to be in one field in one row if its possible. I don't think you do... explain. Quote Link to comment Share on other sites More sharing options...
wookie Posted March 17, 2008 Author Share Posted March 17, 2008 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 Quote Link to comment Share on other sites More sharing options...
fenway Posted March 17, 2008 Share Posted March 17, 2008 group_concat, then. Quote Link to comment Share on other sites More sharing options...
wookie Posted March 17, 2008 Author Share Posted March 17, 2008 Thanks very much I will try that, and will also look up the command to understand it too. Regards Wookie Quote Link to comment Share on other sites More sharing options...
wookie Posted March 18, 2008 Author Share Posted March 18, 2008 Would there be another way of doing this as group_concat is restricted by default to 1024 characters which would be exceeded by my query result and hence truncated? Many thanks Wookie Quote Link to comment Share on other sites More sharing options...
aschk Posted March 18, 2008 Share Posted March 18, 2008 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? Quote Link to comment Share on other sites More sharing options...
fenway Posted March 18, 2008 Share Posted March 18, 2008 Would there be another way of doing this as group_concat is restricted by default to 1024 characters which would be exceeded by my query result and hence truncated? You can change this via a connection variable. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.