Old 29-10-2007   #1 (permalink)
Honorary Member
 
Join Date: Aug 2006
Location: Sydney, Australia
Age: 24
Posts: 1,406
Rep Power: 4
Default Merging 2 Forums: SQL Statement

Hi GG nerd division,
I've dabbled in SQL stuff before, but mainly getting stuff - not changing stuff.
I'm trying to merge 2 phpBB3 forums together.
I'm pretty sure I've got the logic down, now I just need to make it happen.
Here is what I've got so far:

UPDATE database2.phpbb_groups
SET group_id = group_id + SELECT MAX(group_id) FROM database1.phpbb_groups

The bold bit is wrong.
The SELECT MAX statement works on it own, and if you replace the bold statement with a number, it works...but they don't work together at all.

The idea is, I'm trying to get all the unique ID's in database 2 to increment past the max ID in database 1.
Then I've got another seperate script to merge the 2 together.


Any ideas would be really appreciated. Thanks!
__________________
clan ohnd
Pierre: A father-obsessed singer and dancer who appears in various instructional videos teaching children how to dance to hip-hop and meditate, while expressing his desire to meet their dad.
d3v1an7 is offline   Reply With Quote
Old 29-10-2007   #2 (permalink)
GotGames Admin
 
Swordfish's Avatar
 
Join Date: Sep 2007
Location: Sydney, Australia
Posts: 3,429
Rep Power: 5
Default

Quote:
Originally Posted by d3v1an7 View Post
Hi GG nerd division
hmmm
__________________
Swordfish is offline   Reply With Quote
Old 29-10-2007   #3 (permalink)
Pro Member
 
nuk3's Avatar
 
Join Date: May 2006
Location: Sydney, Australia
Posts: 6,539
Rep Power: 9
Default

You didn't tell us what output you're receiving.. An error? Any rows altered at all?
__________________
OM NOM NOM
nuk3 is offline   Reply With Quote
Old 29-10-2007   #4 (permalink)
Honorary Member
 
Join Date: Aug 2006
Location: Sydney, Australia
Age: 24
Posts: 1,406
Rep Power: 4
Default

good point nuk3.
basically, it gives me that awesome error along the lines of:
YOU HAVE DONE A BAD. READ THE DOCUMENTATION TO SEE WHY YOU ARE A NOOB.

Nothing is altered.


I really want to get it done tonight, so I've just gone though and got all the max values manually and am now making a query to update from those numbers.

Sorry it was all a bit vauge, but I think I'm ok from now on. If anyone wants to tell me how to do it better next time though, I'll all for the learnings.
__________________
clan ohnd
Pierre: A father-obsessed singer and dancer who appears in various instructional videos teaching children how to dance to hip-hop and meditate, while expressing his desire to meet their dad.
d3v1an7 is offline   Reply With Quote
Old 29-10-2007   #5 (permalink)
Pro Member
 
nuk3's Avatar
 
Join Date: May 2006
Location: Sydney, Australia
Posts: 6,539
Rep Power: 9
Default

It's probably something silly like there being no brackets around the subquery:

UPDATE database2.phpbb_groups SET group_id = group_id + (SELECT MAX(group_id) FROM database1.phpbb_groups)

The error would tell you what's wrong, but as you said, it doesn't matter now.
__________________
OM NOM NOM
nuk3 is offline   Reply With Quote
Old 30-10-2007   #6 (permalink)
Honorary Member
 
Join Date: Aug 2006
Location: Sydney, Australia
Age: 24
Posts: 1,406
Rep Power: 4
Default

For anyone interested, I ended up getting it done.

But be aware if you want to do something similar, it was 15 hours worth of manual SQL editing and trial and error.

There is no easy 3 click step merge scripts available for phpBB3...yet...and probably wont be for a long time.
__________________
clan ohnd
Pierre: A father-obsessed singer and dancer who appears in various instructional videos teaching children how to dance to hip-hop and meditate, while expressing his desire to meet their dad.
d3v1an7 is offline   Reply With Quote
Old 31-10-2007   #7 (permalink)
Contributing Member
 
Join Date: Jun 2006
Posts: 607
Rep Power: 3
Default

Your error was probably something to do with table level locking.
__________________
92% of teens have moved on to rap. If you are part of the 8% who still listen to real music, copy and paste this into your signature.
Khaless is offline   Reply With Quote
Old 31-10-2007   #8 (permalink)
Monster Member
 
Havoc's Avatar
 
Join Date: May 2006
Location: Sydney
Posts: 2,697
Rep Power: 5
Default

thought this was about SQL

/me bails
__________________
Havoc is offline   Reply With Quote
Old 31-10-2007   #9 (permalink)
Monster Member
 
Join Date: May 2006
Location: Adelaide
Age: 23
Posts: 2,680
Rep Power: 5
Default

Programming is teh suck networking ftw
Snook is offline   Reply With Quote
Old 31-10-2007   #10 (permalink)
Pro Member
 
nuk3's Avatar
 
Join Date: May 2006
Location: Sydney, Australia
Posts: 6,539
Rep Power: 9
Default

Quote:
Originally Posted by Snook View Post
Programming is teh suck networking ftw
What use is networking without programming?
__________________
OM NOM NOM
nuk3 is offline   Reply With Quote
Old 31-10-2007   #11 (permalink)
Monster Member
 
Join Date: Jan 2007
Location: Brisbane, Australia
Age: 19
Posts: 3,500
Rep Power: 6
Default

Quote:
Originally Posted by nuk3 View Post
What use is networking without programming?
Watching the little LEDs on switches blink...

COUNT DEM PACKETS!
__________________
Jayson
Jayso is offline   Reply With Quote
Old 04-11-2007   #12 (permalink)
GotGames Moderator
 
esjay's Avatar
 
Join Date: Aug 2006
Location: brisbane
Posts: 6,023
Rep Power: 9
Default

Quote:
Originally Posted by Jayso View Post
COUNT DEM PACKETS!
QUICK, SOMEONE MAKE THIS MAN A UML DIAGRAM!
__________________

Find me at: #gotgames @ gamesurge

esjay ~ scoTT ~ ~ joeL ~ osprey_ ~ khooy ~ defi|er ~ pudge ~ KEGGGy ~ kotso ~Manji ~ dNb ~ Constance_ ~ aceh ~ subnOize ~ smiterz
Handsome gentleman crew
(club closed - must be a gentleman and a handsome)
esjay is offline   Reply With Quote
Old 04-11-2007   #13 (permalink)
Monster Member
 
Join Date: Jan 2007
Location: Brisbane, Australia
Age: 19
Posts: 3,500
Rep Power: 6
Default

Quote:
Originally Posted by esjay View Post
QUICK, SOMEONE MAKE THIS MAN A UML DIAGRAM!
WHY THE **** ARE YOU MAKING ME A UML DIAGRAM FOR WATCHING LIGHTS BLINK ON NETWORK DEVICES!?!?!?
__________________
Jayson
Jayso is offline   Reply With Quote
Old 04-11-2007   #14 (permalink)
GotGames Moderator
 
esjay's Avatar
 
Join Date: Aug 2006
Location: brisbane
Posts: 6,023
Rep Power: 9
Default

Quote:
Originally Posted by Jayso View Post
WHY THE **** ARE YOU MAKING ME A UML DIAGRAM FOR WATCHING LIGHTS BLINK ON NETWORK DEVICES!?!?!?
SOUNDS LIKE IM GOING TO NEED A FEW INTERACTION DIAGRAMS ASWELL!!!!
__________________

Find me at: #gotgames @ gamesurge

esjay ~ scoTT ~ ~ joeL ~ osprey_ ~ khooy ~ defi|er ~ pudge ~ KEGGGy ~ kotso ~Manji ~ dNb ~ Constance_ ~ aceh ~ subnOize ~ smiterz
Handsome gentleman crew
(club closed - must be a gentleman and a handsome)
esjay is offline   Reply With Quote
Old 05-11-2007   #15 (permalink)
Pro Member
 
nuk3's Avatar
 
Join Date: May 2006
Location: Sydney, Australia
Posts: 6,539
Rep Power: 9
Default

__________________
OM NOM NOM
nuk3 is offline   Reply With Quote
Old 05-11-2007   #16 (permalink)
Monster Member
 
Join Date: Jan 2007
Location: Brisbane, Australia
Age: 19
Posts: 3,500
Rep Power: 6
Default

^ hahaha - that's SO me....
__________________
Jayson
Jayso is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +10. The time now is 09:05 AM.


Powered by vBulletin® Version 3.7.5
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0