如何合并和排序列? MySQL、CF8、MS Access 2003
我想通过将两列名称(columnA 和 columnB)相加来生成按字母顺序排列的名称列表。
我已经尝试过:
<cfquery name="listAuthors" datasource="hhLibrary">
SELECT title, (a1_Fname + a2_Fname) AS ColumnA, (a1_Lname + a2_Lname) AS ColumnB
FROM books
WHERE ColumnB LIKE '#firstletter#%'
ORDER BY ColumnB
</cfquery>
这是错误代码: 参数太少。预期 1.
非常感谢任何帮助。
俄勒冈蜂蜜
I want to produce an alphabetized list of names produced by adding together two columns of names, columnA, and columnB.
I have tried this:
<cfquery name="listAuthors" datasource="hhLibrary">
SELECT title, (a1_Fname + a2_Fname) AS ColumnA, (a1_Lname + a2_Lname) AS ColumnB
FROM books
WHERE ColumnB LIKE '#firstletter#%'
ORDER BY ColumnB
</cfquery>
this is the error code:
Too few parameters. Expected 1.
any help greatly appreciated.
oregonHoney
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
更新:
Update:
在 Jet/ACE SQL 中,您不能在字段名称别名上放置 WHERE 子句或 ORDER BY - 您必须重复别名所引用的表达式。因此,将其替换为:
... 为:
如果您安装了 Access,我强烈建议您在 QBE 中的交互式 Access 中测试您的 SQL。如果您刚刚在 Access 中尝试过,您很快就会发现情况确实如此。
In Jet/ACE SQL you can't place a WHERE clause or ORDER BY on a field-name alias -- you have to repeat the expression the alias is referring to. So, replace this:
...with this:
If you have Access installed, I strongly encourage you to test your SQL in interactive Access, in the QBE. You would quickly have discovered that this is the case if you'd just tried it within Access.