基本 SELECT 找不到条目
我可能在这里犯了一个愚蠢的初学者错误,但 SQL 不是我的强项之一。
我正在尝试修改一个简单的 SQLite DB(在 SQLite Manager 中),但似乎无法做到这一点,直到我弄清楚为什么我无法让此 select 语句返回。
SELECT *
FROM facts
WHERE id = -9215979828305747000
没有抛出任何错误,也没有返回任何内容,无论它是表中的第一个条目。我也
SELECT *
FROM facts
WHERE CAST(facts.id AS INTEGER) = CAST('-9215979828305747000' AS INTEGER)
再次尝试什么也没有。
我在浏览窗口中看到该值,但无法在特定搜索中获取它。发生这种情况是因为值长度吗?
I'm probably making a stupid beginner mistake here but SQL isn't one of my strong points.
I'm trying to modify a simple SQLite DB (in SQLite Manager) but can't seem to do it until I figure out why I can't get this select statement to return.
SELECT *
FROM facts
WHERE id = -9215979828305747000
threw no error and returned nothing regardless of the fact that its the first entry on the table. I also tried
SELECT *
FROM facts
WHERE CAST(facts.id AS INTEGER) = CAST('-9215979828305747000' AS INTEGER)
again nothing.
I see the value in the browse window but can't get it in a specific search. Is this happening because of value length?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
-9215979828305747000 大于 Int32 的最大值 (2147483647),所以我猜facts.id 不是整数。检查您的数据类型并相应地进行 CAST。
也许它是一个字符串?
-9215979828305747000 is bigger than the maximum value for an Int32 (2147483647), so I guess facts.id is not an Integer. Check your datatype and CAST accordingly.
Perhaps it is a string?
我做了这个测试:
所以它似乎在一个全新的表中工作。问题显然不在sql select或key或表定义中。
尝试获取临时表中的数据:
I did this test :
So it seems to work in a fresh new table. The problem is clearly not in the sql select or key or table definition.
Try to get the data in some temporary table :