where子查询懵了,该怎么处理

WBOY
Release: 2016-06-13 12:44:42
Original
893 people have browsed it

where子查询懵了,

本帖最后由 u010572351 于 2013-06-28 17:14:25 编辑

 select goods_id,cat_id, goods_name from goods where goods_id=
 (select max(goods_id) from goods);

语句没有问题问题,返回正确结果!但是:

意思大概是:查询商品表中最后添加的商品信息(goods_id最大),
想法我懂,但是where条件后面的条件值是一个select语句,他虽然返回了一个最大值,但是他是一个select语句啊,应该是一个结果集,不是一个int啊,怎么能和goods_id做比较?懵了。


Related labels:
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