MYSQL:Where子句不明确 [英] MYSQL: Where clause is ambiguous

查看:110
本文介绍了MYSQL:Where子句不明确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我讲的是基础知识,却遇到了错误。我正在运行以下查询:

I'm covering the basics and I've ran into an error. I'm running the following query:

SELECT * FROM monday, tuesday WHERE games_won=3 AND games_drawn=1

并收到此错误:

where子句中的列'games_won'不明确。

我知道这与具有相同字段名称的两个表有关,因此查询将不接受,但我只是不确定要解决的正确SQL。

I know it's got something to do with both tables having the same field name, so the the query won't accept it, but I'm just not sure the correct SQL to fix it.

谢谢。

推荐答案

提供适当的别名以进行查询。将特定表的别名提供给列

give proper alias names to query. Give alias name of particular table to columns

 SELECT * FROM monday mon, tuesday tue 
 where mon.games_won=3 AND tue.games_drawn=1

这篇关于MYSQL:Where子句不明确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆