sql - 为什么我在对具有相似列名的 2 个表进行内部连接时收到“列名重复”错误?
问题描述
CREATE TABLE student_activestudent AS
(
SELECT *
FROM
student
INNER JOIN
activestudent ON activestudent.studentnumber=student.studentnumber
);
我期待一个包含 2 列学生编号的表,但我收到了重复错误-> 重复列名称“学生编号”
解决方案
您不能选择具有相同列名称的两个表。
最好的方法是不要选择 *
按列选择,如果列相同,您可以输入 [as]
例子
选择 student.studentnumber 作为 stuNumber,activestudent.studentnumber 作为acttuNumber
推荐阅读
- javascript - 在输入字段中使用 dd/mm/yyyy 输入日期格式
- java - 无法与 OnClick\OnItemClickListener 中的视图及其事件交互
- neo4j - 从记录列表中创建节点时,如何传递 datetime 属性?
- java - 如何将类的对象分配给值
- flask - 用户的烧瓶个人资料页面
- java - 更改片段 - 如果可能,请改进它
- matlab - x * x ^ T的Matlab符号计算
- c# - 如果字符是大写,则拆分 camelCase str 正则表达式?
- c# - 使用排序算法在 Unity 中说明球的排序过程
- python - tensorflow conv2d的padding策略是什么?