我正在尝试添加默认整数值为 0 的临时列。
Playlist.select("playlists.*, 0 AS point_count")
这几乎就是我想要的,唯一的区别是我希望 0 是一个 int,而不是一个字符串。我该怎么做?
最佳答案
Playlist.select("playlists.*, CAST(0 AS integer) AS point_count")
关于sql - 向表中添加临时整数列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16309214/