首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >函数错误book.Description不存在

问函数错误book.Description不存在
EN

Stack Overflow用户
提问于 2013-12-04 12:43:02
回答 1查看 22关注 0票数 1

我正试着走到这张桌子上:

代码语言:javascript
复制
+-------------------------------------------+------------+------------------------+
| Title                                     | Avg Rating | Description Excerpt    |
+-------------------------------------------+------------+------------------------+
| The Shortest Book in the World            | 10         | A Guide to how Detro...|
| From Deep in the Heart of Texas to IT     | 6          | One man's Journey to...|
| From the Shores of Lake Erie to IT        | 4          | One man's Journey to...|
| The Science of Literature Searching       | NULL       | A Book Worth a Look ...|
| Master Wireless Through The Classic Comics| NULL       | Infrared man triumph...|
| Master HTML Through The Classic Comics    | NULL       | Using his Super Web ...|
| Master C++ Through The Classic Comics     | NULL       | GeekMan triumphs ove...|
+-------------------------------------------+------------+------------------------+
7 rows in set (0.00 sec)

+-------------+--------------+------+-----+---------+-------+
| Field       | Type         | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+-------+
| ISBN        | char(13)     | NO   | PRI |         |       |
| Title       | varchar(70)  | NO   |     | NULL    |       |
| Description | varchar(100) | YES  |     | NULL    |       |
| Category    | int(11)      | YES  | MUL | NULL    |       |
| Edition     | char(30)     | YES  |     | NULL    |       |
| PublisherID | int(11)      | NO   | MUL | NULL    |       |
+-------------+--------------+------+-----+---------+-------+
6 rows in set (0.00 sec)


select b.title as "Title", round(avg(br.rating)) as "Avg Rating", 
CONCAT(Description(1, 20, '...')) as "Description Excerpt" 
from  (book b LEFT JOIN bookreview br on b.ISBN = br.ISBN) 
order by  upper(b.title);  

--------------
select b.title as "Title", round(avg(br.rating)) as "Avg Rating",
CONCAT(Description(1, 20, '...')) as "Description Excerpt"
 from  (book b LEFT JOIN bookreview br on b.ISBN = br.ISBN)
 order by  upper(b.title)
 --------------

错误1305 (42000):函数book.Description不存在

我对这个错误感到困惑,但是当我对我的图书表运行desc时,带有描述的图书表马上就会显示出来。我需要帮助来弄清楚这个问题。

EN

回答 1

Stack Overflow用户

发布于 2013-12-04 12:46:22

我认为您需要一个带有连接的SUBSTR函数,因此,请更改

代码语言:javascript
复制
CONCAT(Description(1, 20, '...'))

至

代码语言:javascript
复制
CONCAT(substr(Description ,1, 20), '...')
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20367009

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档