简单的sql查询语句

WBOY
Release: 2016-06-13 13:35:48
Original
956 people have browsed it

求一个简单的sql查询语句

SQL code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
select cp.*,cpsmallclass.shunxu as cpsmallclass.classorder from cp left join cpsmallclass on cp.smallclassid=cpsmallclass.smallclassid order by cpsmallclass.classorder

Copy after login


就是一个这样的sql查询,从cpsmallclass表里面查询出cpsmallclass的shunxu字段添加到cp表里面。然后按照cpsmallclass里面的shunxu字段进行排序。但是由于cp表里面也有shunxu字段,所以给了个新名字叫做classorder。

应该怎么写?一直报错。

------解决方案--------------------
这样试试:
select cp.*,cpsmallclass.shunxu as cpsmallclass_classorder from cp left join cpsmallclass on cp.smallclassid=cpsmallclass.smallclassid order by cpsmallclass.classorder
------解决方案--------------------
cpsmallclass.shunxu as cpsmallclass.classorder
改为
cpsmallclass.shunxu as classorder
Related labels:
cp
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