本文介绍了MySQL删除左连接上的重复列,3个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!
问题描述
我有三个表,每个表都有一个外键.当我执行连接时,我得到重复的列.
I have three tables, each have a foreign key. When I perform a join, I get duplicate columns.
给定
我的查询语句:
我的目标是从连接中获取所有列中的一行,而没有重复的列.那么我应该使用的 SQL 语句语法是什么?
My objective is to get one row of all the columns from the join without duplicate columns. So what is the SQL statement syntax that I should use?
推荐答案
默认情况下,如果您使用 *
,MySQL 将返回所有表的所有列.您需要在查询中明确输入列名,以按照您想要的方式检索它们.使用查询如下:
By default MySQL will return all columns for all tables if you use *
. You will need to explicitly enter column names in your query to retrieve them the way you want. Use the query as follows:
这篇关于MySQL删除左连接上的重复列,3个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!