Advertisement:

Moving boards in bulk

Aloittaja Anguz, helmikuu 13, 2005, 06:13:50 AP

« edellinen - seuraava »

Anguz

I know this is not available in the Manage Boards area, although it'd be nice. I was wondering what the SQL query would be to move a bunch of boards together. They're childs of board 1 and I want them child of board 2.
Cristián Lávaque http://cristianlavaque.com

[Unknown]

UPDATE smf_boards
SET ID_PARENT = ###
WHERE ID_BOARD IN (xyz);

-[Unknown]

Midgard


Oldiesmann

xyz is a list of the board IDs for the boards whose parent you want to change. It allows you to update this value for multiple boards with one query, instead of having to use "WHERE ID_BOARD = 'x' || ID_BOARD = 'y' || ID_BOARD = 'z'" or run a seperate query for each board.
Michael Eshom
Christian Metal Fans

Midgard

"WHERE ID_BOARD = '1'"

It's true? xyz is board id?

Tony Reid

Hmmm.. sorry to jump in here... but I want to move a board and its boards into a fresh forum.......

If I did something like a select on the above, would it be as straight forward as an update/insert into the other forum?

I realise I have to share the user DB....

:)

Tony Reid

Oldiesmann

#6
Lainaus käyttäjältä: Midgard - helmikuu 14, 2005, 10:09:57 AP
"WHERE ID_BOARD = '1'"

It's true? xyz is board id?

xyz is a list of the board IDs...

For instance - if you wanted to move boards 5,6 and 7 to board 1, you'd do it like this:

UPDATE smf_boards
SET ID_PARENT = '1'
WHERE ID_BOARD IN (5,6,7);


Lainaus käyttäjältä: Tony - helmikuu 14, 2005, 10:10:15 AP
Hmmm.. sorry to jump in here... but I want to move a board and its boards into a fresh forum.......

If I did something like a select on the above, would it be as straight forward as an update/insert into the other forum?

I realise I have to share the user DB....

:)



INSERT INTO db2.smf_boards
SELECT * FROM db1.smf_boards;
Michael Eshom
Christian Metal Fans

Tony Reid

#7
Thank you Oldiesmann! :)

I take it that '*' is the id of the board ... and I can do the same with the sub boards :)
Tony Reid

Oldiesmann

* means select everything. I wasn't thinking about moving just some boards. Do it like this (same principle as above for the "WHERE" clause).

INSERT INTO db1.smf_boards
SELECT * FROM db2.smf_boards
WHERE ID_BOARD IN (xyz);
Michael Eshom
Christian Metal Fans

Tony Reid

Hey thats great - thanks for your help with this :)
Tony Reid

Oldiesmann

Michael Eshom
Christian Metal Fans

Anguz

Thank you [Unknown] and Oldiesmann. :)
Cristián Lávaque http://cristianlavaque.com

Midgard


Advertisement: