I wrote a problem book-diary on Android. There is a database with this structure:

Задачи с датами Повторяющиеся задачи | ID | Имя | | ID | Имя | |----|---------------| |----|-------------| | 1 | Id | | 1 |id | | 2 | дата выполн. | | 2 | тип повтора | //например "каждую неделю" | 3 | время | | 3 | Знач.повтора| //Среда | 4 | Текст задачи | | 4 | Время | | 5 | Текст задачи| 

1) How to create a SQL query to select data from these tables, and to sort by time, regardless of which table took the value.

2) Shove everything into a ListView.

How to do it? Thank you in advance!

  • In this case, I see no reason to divide the entities into tables. They calmly fit in one. And then you will not have any problems with sorting, sampling, etc. - saturov
  • Ie, if the "With date" task - the "Repeat type" and "Repeat value" fields remain empty, and if "repeating" - then the "Execution date" field is left empty? - Alexey
  • one
    repeat type just think up type NONE (no) for tasks without repetition. In general, if you break it up, google on the JOIN topic, SQLITE seems to support it - Vladyslav Matviienko
  • @ Alexey, yes, you caught the point. I do not recommend sculpted humpback, do not be lazy and redo DB. - saturov

1 answer 1

To join additional tables in sqlite, the keyword JOIN is provided. Read about it, a very useful thing. But in your case, as already mentioned in the comments, it is better to store data in one table.