Replies: 1 comment 1 reply
-
的确有这个问题,SQLite 用的应该是 PADL/PADR,不过要支援一下自定义填充内容才行。 如果你的排序字段都是数字,临时的解决方案是用 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
表達式 xxxxx.Where(t => t.SiteId == siteId && t.SportId == request.SportItemId && t.Book == "1")
.OrderBy(t => t.OldId.PadLeft(2, '0'))
.ToListAsync(t=>t.OldId);
生成sql:
SELECT a."old_id" as1
FROM "sport" a
WHERE (a."site_id" = '7' AND a."sport_id" = 'te' AND a."book" = '1')
ORDER BY lpad(a."old_id", 2, '0')
錯誤:
System.Data.SQLite.SQLiteException
SQL logic error
no such function: lpad
at System.Data.SQLite.SQLite3.Prepare(SQLiteConnection cnn, String strSql, SQLiteStatement previous, UInt32 timeoutMS, String& strRemain)
at System.Data.SQLite.SQLiteCommand.BuildNextCommand()
at System.Data.SQLite.SQLiteCommand.GetStatement(Int32 index)
我使用dataGrip執行sql也報錯,sqlite 應該是不支持 lpad 函數
Beta Was this translation helpful? Give feedback.
All reactions