Expected behavior
I need to sum up the article of a contest on steemit. I need to search the last record of each group. In the inner nesting I plan to sort the records in descending order of the field "timestamp", and in the outer nesting I plan to group the records by "permlink". According to my expectations, I should get the recent record of each group.
Actual behavior
In order to test, I wrote four queries to compare. The first is a simple query:
SELECT * FROM sbds_tx_comments WHERE author = "tvb" AND permlink NOT LIKE 're%'AND TIMESTAMP > '2018-01-24 00:00:00'
The second is a simple query with ordering:
SELECT * FROM sbds_tx_comments WHERE author = "tvb" AND permlink NOT LIKE 're%'AND TIMESTAMP > '2018-01-24 00:00:00' ORDER BY TIMESTAMP DESC
The third is a nested query:
SELECT permlink, TIMESTAMP FROM ( SELECT * FROM sbds_tx_comments WHERE author = "tvb" AND permlink NOT LIKE 're%' AND TIMESTAMP > '2018-01-24 00:00:00' ORDER BY TIMESTAMP DESC)tmp GROUP BY permlink
The fourth is another nested query:
SELECT permlink, TIMESTAMP FROM ( SELECT * FROM sbds_tx_comments WHERE author = "tvb" AND permlink NOT LIKE 're%' AND TIMESTAMP > '2018-01-24 00:00:00' ORDER BY TIMESTAMP ASC)tmp GROUP BY permlink
How to reproduce
I will provide the screenshot for the results of these queries. The result of the first query is as below:
According to the picture, in the records whose "permlink" is equal to "laodr-or", the "timestamp" of the first record is "2018-01-25 09:53:42". The record is the first in the physical order of the table.
The result of the second query is as below:
In the picture, we can see that, in the records whose "permlink" is equal to "laodr-or", the timestamp" of the first record is "2018-01-26 05:15:57". That means the last modified version of the link "laodr-or" is at "2018-01-26 05:15:57".
Then let me show the result of the thrid query:
Aft
er grouping, the result should show the last record of each group, whose timestamp is max. But in the screenshot, we can see ,the first record whose "link" is "laodr-or" is at "2018-01-25 09:53:42", which is the same as the first query, not the second!
Let's watch the fourth:
The result is the same as the first and the third one.
In conclusion, in nested query, grouping after sorting, the ordering is invalid. In each group, the result the first record of the physical order of the table.
Chrome version 63 64bit
Win 10 64 bit
(Both of them are uninfluential in the bug.)
I tested the bug with phpMyAdmin - 2.11.9.2. Of course the bug still exists when I use php to connect the SBDS. And I have exported a few data to my local mysql database, there isn't the bug.
Posted on Utopian.io - Rewarding Open Source Contributors
哇,一姐整起来是杠杠的啊!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
不知道这算不算bug呀,不过正常的mysql不应该这样,我还在等待utopian-io的宣判。
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
找justyy给你审啊,让他给你过一下
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
不能给我偶像添乱哈哈
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
这怎么叫添乱呢?!这叫创收!
他多通过一条,也多一份收入不是
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
我突然想到我还有一点需要解释一下,我修改一下。
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
好像不用。。。
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
我还希望有外国的偶像帮我审一下,还能我认识认识哈哈。幻想能涨个粉啥的哈哈哈哈。
论贪心,只能是我哈哈哈
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Your contribution cannot be approved because it does not follow the Utopian Rules.
Hi this is not a bug. Your correct SQL should be
You can contact us on Discord.
[utopian-moderator]
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
优秀!!这样的人才!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
我这还不一定能通过呢。。。。
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
我的妈,中文区都是程序猿!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
我是伪程序员,你不要怕。
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
呃,竟然是程序员,我要快快躲起来,显得我水平太低...
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
伪程序员,你怕啥,我觉得你比我厉害呢
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
我也想伪一下,可是没有这个能力
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
你会的很多了,画画和设计这些都是需要很深的功力呢。我好羡慕你画画画得超好!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
如果具备能力代理或者能力转让,那就好了。能力区块链
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
I have no idea what you're talking about, but I can assure you the problem is with me, not you. Great stuff!!!!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
I have described it not very well.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
You're English is getting very good, you are starting to defend yourself now 😉
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
defend myself?这是自我保护的意思?
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
可以解作自我保護,自辯,解釋。總之我覺得用外語 defend yourself, 代表你對自己外語開始有信心 👍👍👍
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
没有信心呀,这个utopian-io找bug要求必须用英语说明,我是勉强描述这个bug的。。。。
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
@tvb 很難接受別人讚美
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
我們要多讚美她
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
逆天了!!!开始全英文写作了啊!!!!厉害
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
我十分想写中文,问题是utopian不让呀。。。。我从上午11点写到现在。。。累屎了
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
不错不错,怎么感觉在这里要混不下去了,大家都是多面手,让我这种人怎么办?
我今天也在utopian上提交了一个WordPress的插件,希望帮支持一下。
https://steemit.com/utopian-io/@rileyge/wordpress-plugin-to-sync-wordpress-and-steemit-comments
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
我一共就发了这一篇呢,不像你那么厉害呢,我要向你学习,你是在一个方向上专业精!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
不专也不精的,我的水平只是外行人觉得很厉害,和大神一比的话就原型毕露了。
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
给姐大赞!虽然也没多少,😄
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
谢谢啦,要是帮我看看我的英文表述我就更感激了哈哈,我有点不要脸是不是
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
百分百赞我好感动,谢谢妹妹!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
我手动赞都是百分百,哈哈,姐有时候不是是因为把姐添到自动点赞了。为了能恢复一些,好持续点赞,才设置的比例,没有别的意思哦。:-)有时候在自动点赞前看到文章就手动点了。希望理解哈。
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
我没也没怎么注意过点赞其实,自从接受了 @dapeng的活动,精力都在活动上了。
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
姐辛苦啦!赞!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
厉害了 T姐居然是程序媛
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
伪的。。我水平太初级了!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
询问TVB姐,你用什么软件作SQL data extraction ?😊
是直接从steem API拿数据吗?还是通过SteemSQL ?
谢谢。。
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
LINQPad5是大家最常用的工具,我是写在php里连的。
我这用的是有人新建的mysql数据库,api我还不会用呢,steemsql不是收费了嘛
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
谢谢TVB的资讯。。😊
不知道有人新建mysql..😅
之前是用SteemSQL,要收费后没再用。
我也用linqpad5。。
会去找找mysql..
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
https://steemit.com/dev/@privex/privex-launches-steem-blockchain-database-service
我用的是这个,速度不怎么快,表也不怎么全,但还好,现在用的人不多所以还好。
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
谢谢TVB。。
我昨天在Steemit上搜索Steem MySQL,发现这两篇文章:
https://steemit.com/steemdata/@furion/steemdata-meets-sbds-sql-users-rejoice
https://steemit.com/steemit/@dimitrisp/steemysql-announcing-an-alternative-mysql-db-to-steemdata
Steemdata, Steemysql...不懂可用没有。。
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
steemdata都说数据不全,steemsql没用过
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
赞一个,但是我看不懂
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
谢谢艺弟!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
程序一姐!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
这可不能这么说,我程序水平就太初级了,真不能这么叫,还是叫我分割线一姐吧哈哈哈
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
进步最大就是你了!厉害了。
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
T姐,厉害,T姐,这是我的https://steemit.com/@sheng6093
你能给我提一些意见吗, 谢谢
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
我也不行事呀。。。你高估我了
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
TEST 3
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
恭喜开张!一定很有成就感!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
呜呜呜,我这个没开张,被拒了。过我还是很开心的,因为有学到东西。
还是stacee留意我,看到这是我的第一次投稿,我感动了。
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit