I'm asking because in the documentation for a rawQuery(), it refers to using SQL statement. So does this mean I have access to SQL features and not just SQLite features? I'm trying to do a recursive aggregate (count) query, but SQLite doesn't support this, so I was hoping that Android allows all SQL features. I also don't know how to a.) Modify my code to get the count in SQLite or b.) if what I have would work in SQL because I am using a SQLite db and c.) I can't tell if what I have would even work if it was allowed in SQLite. Here's my query:
WITH RECURSIVE desc_table(counter, hourly, current_weather_description, time_stamp) AS (
Select count(*) AS counter,
CASE WHEN strftime('%M', 'now') < '30'
THEN strftime('%H', 'now')
ELSE strftime('%H', time_stamp, '+1 hours')
END as hourly,
current_weather_description,
time_stamp
From weather_events
GROUP BY strftime('%H', time_stamp, '+30 minutes'), current_weather_description
UNION ALL
Select counter, hourly - 1, current_weather_description, time_stamp
From desc_table
GROUP BY strftime('%H', time_stamp, '+30 minutes'), current_weather_description
Order By counter desc limit 1
Select counter, hourly, current_weather_description, current_icons
From desc_table
Basically I have some weather data that I group into hour intervals (offset by 30 minutes) and I want to specifically count the number of times I get a particular weather description in that time interval and select the weather description within that time interval with the highest occurence (count).
Aucun commentaire:
Enregistrer un commentaire