In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to group in Sequoiadb". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to group in Sequoiadb".
[problem description]
When aggregating queries, can the character type fields be grouped and deduplicated according to the actual content?
Example:
1. Insert data contains string
Db.cs.cl.insert ({a: {"20190101000000"}})
Db.cs.cl.insert ({a: {"20190101111111"}})
Db.cs.cl.insert ({a: {"20190103000000"}})
two。 Can the string format be grouped and deduplicated according to the content of 20190301 in the execution of aggregate query?
[solution]
1. At present, the SequoiaDB aggregate function does not support grouping a segment of a string, but only supports grouping and deduplicating the entire string.
two。 From the point of view of the customer's problem, the customer wants to convert the timestamp in string format into time content for grouping, and the most convenient way is to implement it through SQL syntax.
3. To solve customers' problems, you can use SequoiaSQL-MySQL/SequoiaSQL-PostgreSQL + SequoiaDB tool and standard SQL statements to convert timestamps in string format into date content for grouping and de-duplication. Examples are as follows:
1) use SQL statement to create a table:
Mysql > create table T1 (a char (16))
2) insert data
Mysql > insert into T1 values ("20190101000000")
Mysql > insert into T1 values ("20190101111111")
Mysql > insert into T1 values ("20190103000000")
3) use the SQL statement to convert the string format to date content for grouping and de-duplication
Mysql > select count (a), date_format (a.'% Ymuri% mmury% d') a from T1 group by date_format (a,'% Ymuri% mmi% d')
4) step 3, the query results are as follows:
Count (a) a
2 2019-01-01
1 2019-01-03
4. If the string content is not in timestamp format, it cannot be converted to date content to be grouped and deduplicated
Thank you for your reading, the above is the content of "how to remove weight in Sequoiadb". After the study of this article, I believe you have a deeper understanding of how to remove weight in Sequoiadb, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.