标签云

微信群

扫码加入我们

WeChat QR Code

Well, what I mean is I want to create a new table called 'personas2' with the dates of 3 columns from another table called 'personas' (that table has 5 columns, but I only need 3 of them), and, at the same time, I need insert the values of that 3 columns from 'personas' into 'personas2' where the value of one column 'cod_hospital' is 4.This is what I did: use bd_hospital; create table personas2 ( dni int PRIMARY KEY, apellidos varchar(50), funcion varchar(30))select dni, apellidos, funcion from personas where cod_hospital=4;It works, but I want to know if exists another way for that, I mean, create the table without add the columns for myself, something like: insert into personas2 select dni, apellidos, funcion from personas where cod_hospital=4;


That's it. That's what I need. Thank you so much.

2019年04月22日03分06秒

No problem ilos28 :)

2019年04月22日03分06秒

that's a comment, not an answer.

2019年04月22日03分06秒

No, it's an answer, just not the answer.

2019年04月22日03分06秒

In the beginning It was what I did, but I remember that there's another way simpler than that.

2019年04月22日03分06秒

That was what I tried, but It didn't work... at least like I need. But thanks for your answer.

2019年04月22日03分06秒