SQL语句格式

WBOY
Release: 2016-06-06 20:12:43
Original
942 people have browsed it

$sql = "
SELECT indexs.* FROM sdb_content_article_indexs indexs
INNER JOIN sdb_content_article_nodes nodes
ON indexs.node_id = nodes.node_id
WHERE nodes.node_name = '$newsNode'
ORDER BY indexs.pubtime DESC;

<code>        ";
        
        
        第二行index.*以及后面表名后的 indexs什么意思?</code>
Copy after login
Copy after login

回复内容:

$sql = "
SELECT indexs.* FROM sdb_content_article_indexs indexs
INNER JOIN sdb_content_article_nodes nodes
ON indexs.node_id = nodes.node_id
WHERE nodes.node_name = '$newsNode'
ORDER BY indexs.pubtime DESC;

<code>        ";
        
        
        第二行index.*以及后面表名后的 indexs什么意思?</code>
Copy after login
Copy after login

第二行的index.* 表示: 获取index表的所有字段值;
indexs表示: 给sdb_content_article_indexs做别名,名称为indexs;这样方便简化sql语句长度;后面的同理

indexs.* 是查询这个表的所有字段,后面的indexs是别名

表的 别名,

别名,为了多表查询就用到别名了;你应该学下sql的语法,基础很重要

Related labels:
php
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template