Home Backend Development PHP Tutorial 这条SQL语句究竟错在哪里?解决方案

这条SQL语句究竟错在哪里?解决方案

Jun 13, 2016 am 10:25 AM
like or where

这条SQL语句究竟错在哪里??

SQL code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->SELECT *FROM `offcn_c_all2012`WHERE (`type` LIKE '机关')OR ((`zhuanye` LIKE '%社会学%')OR (`zhuanye` LIKE '%授法学或哲学学士学位%')OR (`zhuanye` LIKE '%社会工作%')OR (`zhuanye` LIKE '%授法学或哲学学士学位%')OR (`zhuanye` LIKE '%社会工作%')OR (`zhuanye` LIKE '%人口学%')OR (`zhuanye` LIKE '%家政学%')OR (`zhuanye` LIKE '%人类学%')OR (`zhuanye` LIKE '%女性学%'))OR ((`other` LIKE '机关')OR (`other` LIKE '%社会学%')OR (`other` LIKE '%授法学或哲学学士学位%')OR (`other` LIKE '%社会工作%')OR (`other` LIKE '%授法学或哲学学士学位%')OR (`other` LIKE '%社会工作%')OR (`other` LIKE '%人口学%')OR (`other` LIKE '%家政学%')OR (`other` LIKE '%人类学%')OR (`other` LIKE '%女性学%')) LIMIT 0 , 10
Copy after login

提示错误是 #1054 - Unknown column 'other' in 'where clause' 


想来想去,也找不出哪错了,另外数据库是有这些字段的



------解决方案--------------------
重新书写select语句的other,复制过来的东西有时候也不可靠。然后看看表结构看有没有空格什么的或者哪个字符打错了。我上次复制的insert语句还说有问题。仔细检查检查吧。
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 AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

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)

Hot Topics

Java Tutorial
1658
14
PHP Tutorial
1257
29
C# Tutorial
1231
24
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

Practical Guide to Where Method in Laravel Collections During the development of the Laravel framework, collections are a very useful data structure that provide rich methods to manipulate data. Among them, the Where method is a commonly used filtering method that can filter elements in a collection based on specified conditions. This article will introduce the use of the Where method in Laravel collections and demonstrate its usage through specific code examples. 1. Basic usage of Where method

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 collection Laravel is a popular PHP framework that provides a wealth of functions and tools to facilitate developers to quickly build applications. Among them, Collection is a very practical and powerful data structure in Laravel. Developers can use collections to perform various operations on data, such as filtering, mapping, sorting, etc. In collections, the Where method is a commonly used method for filtering the collection based on specified conditions.

What is the difference between MySQL's REGEXP and LIKE? What is the difference between MySQL's REGEXP and LIKE? May 30, 2023 pm 01:58 PM

1. The difference in matching content. LIKE requires that the entire data must be matched. With Like, all the contents of this field must meet the conditions; REGEXP only requires partial matching, and only one fragment needs to be satisfied. 2. Differences in matching positions: LIKE matches the entire column. If the matched text appears in the column value, LIKE will not find it and the corresponding row will not be returned (unless wildcards are used); REGEXP is within the column value. A match is performed. If the matched text appears in the column value, REGEXP will find it, the corresponding row will be returned, and REGEXP can match the entire column value (same effect as LIKE). 3. The SQL statement returns data that differs from LIKE matching: the SQL statement

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 Introduction: In the process of data processing and analysis, the selector is a very important tool. Through selectors, we can extract the required data from the data set according to specific conditions. This article will introduce the usage skills of is and where selectors to help readers quickly master the powerful functions of these two selectors. 1. Use of the is selector The is selector is a basic selector that allows us to select the data set based on given conditions.

How to use the mysql database LIKE operator in python How to use the mysql database LIKE operator in python May 31, 2023 pm 09:46 PM

The LIKE operator is used to search for a specified pattern in a column in the WHERE clause. Syntax: SELECTcolumn_name(s)FROMtable_nameWHEREcolumn_nameLIKEpatternpattern This is where the specified template is placed, and "%" is used here, also called the wildcard character %. If it is placed in front of the condition, it will search for data ending with...; for example: % If Li % is placed after the condition, then the data starting with... is searched; for example: Li %% exists before and after the condition, then the included data is searched; for example: % Li % Little knowledge point: ERROR1064 (42000):Youhaveane

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

Preface When we write SQL statements, we cannot avoid using connection keywords, such as inner connections and outer connections. There are many types. I will post here a picture I found elsewhere: I think this picture is very detailed. It shows the common link types in SQL statements. Take leftjoin in this article as an example. It is available online. As defined: the LEFTJOIN keyword will return all rows from the left table, even if there are no matching rows in the right table. In fact, literally speaking, leftjoin is relatively easy to understand, but there are still some problems during use. For example, if the condition is after on and after where, their results are completely different. Let's go from shallow to deep

How to use AND operator and OR operator in SQL statement How to use AND operator and OR operator in SQL statement May 28, 2023 pm 04:34 PM

SQLAND&OR OperatorThe AND and OR operators are used to filter records based on more than one condition. AND and OR combine two or more conditions in the WHERE substatement. The AND operator displays a record if both the first and second conditions are true. The OR operator displays a record if either the first condition or the second condition is true. "Persons" table: LastNameFirstNameAddressCityAdamsJohnOxfordStreetLondonBushGeorgeFifthAvenueNewYorkCarter

How to use Union to optimize Like statement in MySQL How to use Union to optimize Like statement in MySQL May 31, 2023 pm 03:55 PM

Optimize the Like statement with Union 1) Sometimes, you may need to use the or operator for comparison in the query. When the or keyword is used too frequently in the where clause, it may cause the MySQL optimizer to mistakenly choose a full table scan to retrieve records. The union clause can make queries execute faster, especially when one of the queries has an optimized index and the other query also has an optimized index. For example, when there are indexes on first_name and last_name respectively, execute the following query statement: mysql>select*fromstudentswherefirst_namelike'A

See all articles