Home Backend Development PHP Tutorial Column 'languageid' in where clause is ambiguous异常

Column 'languageid' in where clause is ambiguous异常

Jun 13, 2016 pm 01:07 PM
where

Column 'languageid' in where clause is ambiguous错误
我要进行多表查询,而languageid两个表中都该字段,网上的解决方法是在WHERE 后的条件字段中加上表名
where tablea.classid=xxx and tableb.classid=xxx
但是因为我的条件无论对tablea,tableb都是一样的,非要这么麻烦的写吗

------解决方案--------------------
当然不必写这么麻烦,判断的条件一样,就尽量写精点,不要那么多判断,这样反而对MySQL引擎有不好的影响。
------解决方案--------------------
表联合查询的时候,有相同字段必须在字段加面加上表名或者表的别名.
一般遇到这种情况都用表的别名.

如:
select t1.id, t2.id from table1 as t1, table2 as t2 where t1.id = t2.id
------解决方案--------------------
区分多个table就需要
------解决方案--------------------
一定要指定从那个表里拿languageid。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use the Where method in Laravel collections How to use the Where method in Laravel collections Mar 10, 2024 pm 10:21 PM

How to use the Where method in Laravel collections

A Practical Guide to the Where Method in Laravel Collections A Practical Guide to the Where Method in Laravel Collections Mar 10, 2024 pm 04:36 PM

A Practical Guide to the Where Method in Laravel Collections

From beginner to proficient: Master the skills of using is and where selectors From beginner to proficient: Master the skills of using is and where selectors Sep 08, 2023 am 09:15 AM

From beginner to proficient: Master the skills of using is and where selectors

The basic usage of mysql left join and the difference between on and where The basic usage of mysql left join and the difference between on and where Jun 02, 2023 pm 11:54 PM

The basic usage of mysql left join and the difference between on and where

Usage analysis of Where method in Laravel collection Usage analysis of Where method in Laravel collection Mar 09, 2024 pm 06:51 PM

Usage analysis of Where method in Laravel collection

Detailed explanation of Where method of Laravel collection Detailed explanation of Where method of Laravel collection Mar 10, 2024 pm 01:33 PM

Detailed explanation of Where method of Laravel collection

How to use the WHERE clause in SQL to specify selection criteria How to use the WHERE clause in SQL to specify selection criteria Jun 03, 2023 pm 04:31 PM

How to use the WHERE clause in SQL to specify selection criteria

Common errors and solutions to where method in Laravel Common errors and solutions to where method in Laravel Mar 10, 2024 pm 06:03 PM

Common errors and solutions to where method in Laravel

See all articles