Closed shumyun closed 10 months ago
忘记说了。现在用的 @koishijs/plugin-database-mysql 的版本是 5.5.5
之前用的版本不记得,是4.15.0 自带安装的。
目前解决的方案是
const _data = await this.ctx.database.select('platform').where({ pid: 1, publish: { $ne: 1 },}).execute();
获取所有数据后,再使用 _data.length
;这样没问题!
Describe the bug
使用4.15.0版本时不会出现问题,这次升级4.15.4 时就出现问题: 源代码为
const count = await this.ctx.database.select('platform').where({ pid: 1, publish: { $ne: 1 }, }).execute((row) => $.count(row.id));
提示错误:2023-11-08 20:05:34 [W] mysql > SELECT count(distinct id) AS value FROM (SELECT id, pid, mid, publish, time, data FROM ‘platform’ zgkjgyjb WHERE pid = 1 AND publish != 1)
2023-11-08 20:05:34 [W] ESV.upload uploading BD : Error: ER_DERIVED_MUST_HAVE_ALIAS: Every derived table must have its own alias
为什么会出现这个 zgkjgyjb 这个乱码Steps to reproduce
无
Expected behavior
无
Screenshots
No response
Versions
Additional context
No response