简体   繁体   中英

mysql - copy from one database to another

I'm trying to copy data from one DB into another on the same server. For this I'm using a bash script:

mysql -uroot -pMYPW -D "ucb-pvapp" -e "insert into app_daily_quartiles (postcode, lo_limit, hi_limit, median) select (PLZ, loLimit, hiLimit, median) from solarlogmesswerte.tagesquartilekleinraum2"

I tried using the dbDest.table notation for the destination too but that gave me an error.

Now I get. ERROR 1241 (21000) at line 1: Operand should contain 1 column(s)

But I'm not able to find the error.

Using version: 8.0.23-0ubuntu0.20.04.1

Remove brackets from select . So it should go like

insert into app_daily_quartiles (postcode, lo_limit, hi_limit, median) 
select PLZ, loLimit, hiLimit, median from solarlogmesswerte.tagesquartilekleinraum2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM