English 中文(简体)
了解我的SQL问题
原标题:Understanding a MySQL query
  • 时间:2011-11-09 10:06:13
  •  标签:
  • mysql

我现在比以往任何时候更经常地看到这样的问题。 我所损失的是第1页,作为条款,以及第3页。 任何人都想向我解释这些部分,或把我提到资源,因为我没有在谷歌中寻找什么?

SELECT p.title, SUBSTR(p.post,1,300) as post 
FROM Posts p 
WHERE p.title LIKE  %{$q}%  
  OR p.post LIKE  %{$q}% ");
最佳回答

“p. 标题”与“从邮局起”“p”相关联。 在“从”部分中,如果你添加这些内容,你可在问询中通过使用事先确定的内容,把所有地点都列入本表的栏目。 这尤其有助于加入,如果你不止一次加入同一表格,或在不同表格中拥有相同名称的栏目。

“就像”只是显示。 该数据库将显示数据库中原栏标题而不是原栏标题之后指定的名称。

问题回答
SELECT p.title, SUBSTR(p.post,1,300) AS post 
FROM Posts p 
WHERE p.title LIKE  %{$q}%  OR p.post LIKE  %{$q}% "

如第2行所示,“p”是“员额”中的一项内容。 简称“员额”栏。

页: 1 在与具有相同外地名称的多个表格合作时,在实践中非常精干。

更多细节

这里是表中的其他部分。 这不是混淆......

FROM Posts p - here, p is an alias of the table Posts. This means that in the rest of the query, you can use p instead of the table name Posts. Also you can also use FROM Posts as p as well.

The dotted notation is in the form of table.column. <>条码/代码>关键词表示,可选择<条码>column1为<条码>column456。 <代码>FROM 页: 1

您可以使用“AS”来做一个您后来可在网站上检索的别件(栏目)。 同样,“Posts p”是“Posts as p”的短处,而“Posts as p”则允许你将p作为其他询问的表格名称。

从一看,查询似乎采用了非常简单的搜索引擎。 <代码>SUBSTR(p.post,1,300)将回复员额案文的头200个特性。 由于结果单中将有一个栏目,即<编码>SUBSTR(p.post,1,300),因此,新增的AS条款将这一栏改为post

识字和识字能力是一种紧密的配对功能,它融入了MySQL,使你能够以简单的方式配对体。 百分比是符合任何特性的野生卡。 q 或许是一位地方持有人,他们被实际上将在争 que发生时加以搜查的护卫所取代。

<代码>FROM 页: 1 这意味着你可以写一个略短的问。

因此,提交人稍微通过书写方式背书p.,其原因如下:(或Posts. ,如果他有的话,则该编码相当于<>> <>/code>。





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签