My problem is that I know nothing about SQL queries, but need to do something that I think shouldn't be difficult. I've tried some of the recommended questions but I just can't really understand how to extrapolate it to my case, hope you can help me.
Basically what I need is to create some rows in the table and use Values from other rows in the same table, I'd try to be very specific.
I have a table (vb_postmeta) with a lot of rows, some of them look like this:
meta_id | post_id | MetaKey | 元value |
---|---|---|---|
1434 | 500 | bpxl_videourl | 1006hyOKoUM |
1435 | 501 | bpxl_videourl | skjd9F008mN |
What I need here is, for each row, create a new row like this:
meta_id | post_id | MetaKey | 元value |
---|---|---|---|
automatic | 500 | csco_post_video_url | https://www.youtube.com/watch?v=lOO6hyOKoUM |
automatic | 501 | csco_post_video_url | https://www.youtube.com/watch?v=skjd9F008mN |
meta_id is the key and therefore should be automatically generated, while post_id should be the same and meta_value should also have the same value with the Youtube URL appended in front.
I really don’t know how difficult this is, but I hope it’s not too hard,
Thanks in advance for any help, been struggling with this.
Assuming your meta_id is AI (auto-increment) and using mySQL (minor modification of MSSQL), try:
Based on the suggested answers, I ended up using this: