wcdb icon indicating copy to clipboard operation
wcdb copied to clipboard

getOneDistinctColumnOnResult 被移除之后,如何实现同样的查询

Open starfalling opened this issue 2 years ago • 1 comments

The language of WCDB

Objective-C

The version of WCDB

2.1.8

The platform of WCDB

iOS

The installation of WCDB

Cocoapods

What's the issue?

尝试了下面的代码,转换出来的 sql 并没有按预期包含 distinct

  WCTOneColumn *result = [_database getColumnOnResultColumn:WCDB::Expression(MGEpisodeWatchedItem.cartoon_id).distinct()
                                                  fromTable:[self.class episodeWatchTableName]];

这段代码生成的 sql 是

SELECT cartoon_id FROM episode_watch ORDER BY rowid ASC

没有找到如何才能实现 select distinct cartoon_id ***,故发 issue 求助

starfalling avatar Oct 21 '24 08:10 starfalling

[self.database getColumnFromStatement:WCDB::StatementSelect().select(MGEpisodeWatchedItem.cartoon_id).distinct().from([self.class episodeWatchTableName])]

Qiuwen-chen avatar Oct 22 '24 00:10 Qiuwen-chen