I have two buckets in couchbase server:
demographics
{“country_id”:“BGD”,“country_name”:“Bangladesh”,“population”:“164700000”,“area”:“148460”,“density”:“1265”},
{“country_id”:“DEU”,“country_name”:“Germany”,“population”:“83200000”,“area”:“357386”,“density”:“232”},
statistics:
{"country_id":"DEU","dt":"2022-02-17","confirmed_cases":"235626","deaths":"261"},
{"country_id":"DEU","dt":"2022-02-16","confirmed_cases":"219972","deaths":"455"},
{"country_id":"BGD","dt":"2022-02-17","confirmed_cases":"3539","deaths":"20"},
{"country_id":"BGD","dt":"2022-02-16","confirmed_cases":"3929","deaths":"15"},
I want to retrieve the maximum deaths value countrywise. Earlier it showed correct results, but now i am getting the following error:
{
"code": 4330,
"msg": "No index available for ANSI join term s",
}
Here is my query:
SELECT d.country_name Country, m[0] AS Highest_Death, m[1] AS
`Reported_Date`
FROM demographics d JOIN `statistics` s ON
d.country_id = s.country_id GROUP BY d.country_name
LETTING m = MAX([TO_NUMBER(s.deaths), s.dt]) ORDER BY m[0] DESC
I want the result like this: highest death with country
country_name dt deaths
GERMANY 2022-02-16 455
BANGLADESH 2022-02-17 20