在select select运算符中嵌入select

时间:2014-10-08 01:17:20

标签: sql ms-access select

我有一个数据库,我尝试在字段中连接一些值,如下所示:

SELECT ('29434-'&`book`.id&'-'&`book`.page&'-'&`book`.part&(select count(`title`.tit) from `title` where `title`.id = `book`.id) AS ID,
`book`.nass AS content, `book`.part, `book`.page FROM `book` ORDER BY `book`.id, `book`.page 

我收到有关缺少运算符的错误消息。 concat工作正常没有嵌入选择。我怎么能管理这个?

1 个答案:

答案 0 :(得分:1)

我想你忘了关闭第一个括号。我不太确定你必须关闭它,或者你可能会删除第一个

SELECT '29434-'&`book`.id&'-'&`book`.page&'-'&`book`.part&(select count(`title`.tit) from `title` where `title`.id = `book`.id) AS ID,
`book`.nass AS content, `book`.part, `book`.page FROM `book` ORDER BY `book`.id, `book`.page