Ticketa
Registered
Имам база данни database1 таблица `listings` с колони id, title, slug, description, price, status
Колоната `status` е със стойност "1" (активно)
Имам и база данни database2 таблица `ea_listing` с колони listing_id, title, slug, price, status
Колоната `status` е със стойност "active" (активно)
Как мога да копирам от database1 таблицата с колоните, които съм посочил във втората база от данни?
Предполагам логиката ми е правилна, въпроса е как да заменя стойността 1 с "active" на колона `status`
ЕДИТ: Обаче, ми даде грешка при горната заявка:
Грешка
Статичен анализ:
47 errors were found during analysis.
Unexpected character. (near "[" at position 67)
Unexpected character. (near "]" at position 78)
Unexpected character. (near "[" at position 89)
Unexpected character. (near "]" at position 95)
Unexpected character. (near "[" at position 106)
Unexpected character. (near "]" at position 111)
Unexpected character. (near "[" at position 122)
Unexpected character. (near "]" at position 134)
Unexpected character. (near "[" at position 145)
Unexpected character. (near "]" at position 151)
Unexpected character. (near "[" at position 162)
Колоната `status` е със стойност "1" (активно)
Имам и база данни database2 таблица `ea_listing` с колони listing_id, title, slug, price, status
Колоната `status` е със стойност "active" (активно)
Как мога да копирам от database1 таблицата с колоните, които съм посочил във втората база от данни?
Код:
INSERT INTO `database2`.ea_listing
(
[listing_id],
[title],
[slug],
[description],
[price],
[status]
)
SELECT id, title, slug, description, price, status
[id],
[title],
[slug],
[description] ,
[price] ,
[status]
FROM `database1`.`listings`
WHERE `id` > 50
Предполагам логиката ми е правилна, въпроса е как да заменя стойността 1 с "active" на колона `status`
ЕДИТ: Обаче, ми даде грешка при горната заявка:
Грешка
Статичен анализ:
47 errors were found during analysis.
Unexpected character. (near "[" at position 67)
Unexpected character. (near "]" at position 78)
Unexpected character. (near "[" at position 89)
Unexpected character. (near "]" at position 95)
Unexpected character. (near "[" at position 106)
Unexpected character. (near "]" at position 111)
Unexpected character. (near "[" at position 122)
Unexpected character. (near "]" at position 134)
Unexpected character. (near "[" at position 145)
Unexpected character. (near "]" at position 151)
Unexpected character. (near "[" at position 162)