I have 2 tables 1 for categories and the other for tasks.
Every category has a priority.
I'm trying to select the category with the highest priority that has tasks (ignoring categories that have no tasks) i created a view named testView that displays the tasks.
The problem is that if all categories have no tasks it returns 1 result with all field null
This is my query:
select tv.*, min(tv.priority) from testView tv WHERE (select count(*) AS count from schedules WHERE schedules.category = 2 AND schedules.active = 1) > 0
The problem seams to be that when the result of the sub query is 0 then the main query looks like this:
select tv.*, min(tv.priority) from testView tv WHERE 0 < 0
And that returns null values
I'm working with sqlite on android
Thanks alot Avi
Aucun commentaire:
Enregistrer un commentaire