私はこのような何かを推測:
SELECT name, COUNT(countUnread) AS countUnread, COUNT(countRead) AS countRead, MAX(mostRecentDateUnread) AS mostRecentDateUnread, MAX(mostRecentDateRead) AS mostRecentDateRead FROM (
SELECT newsgroupName AS name, COUNT(newsgroupName) AS countUnread, 0 AS countRead, MAX(date) AS mostRecentDateUnread, NULL AS mostRecentDateRead
FROM Article
WHERE read = 0
GROUP BY newsgroupName, read
UNION ALL
SELECT newsgroupName AS name, 0 AS countUnread, COUNT(newsgroupName) AS countRead, NULL AS mostRecentDateUnread, MAX(date) AS mostRecentDateRead
FROM Article
WHERE read = 1
GROUP BY newsgroupName, read
)
GROUP BY name
を私は試していないが、いくつかの修正と、理論的にはそれが仕事ができます。
良い、私は何かを学んだ:) –
これは私が求めたものです!私が見なければならないのは、roomデータベースとliveオブジェクトのアンドロイドアプリケーションでこれを実装すると、パフォーマンスヒットだけです。とにかくありがとう! – HugoCodes