Having not a SQLite background, I'm struggling building a "simple" SQLite query.
Considering the simplified schema below:
** Table: EVENTS **
id content
1 abc
2 xyz
** Table: TIMESLOTS **
id start end
1 05-2022 06-2022
1 10-2022 12-2022
2 ....... .......
我想要在下面这样的基础上构建对象:
{
id: 1,
content: abc,
timeslots:
[
{start: 05-2022, end: 06-2022},
{start: 10-2022, end: 12-2022},
...
]
},
...
我能够在2个查询中完成它,然后以编程方式构建对象(很容易!)
SELECT * FROM events WHERE id = 1
SELECT * FROM timeslots WHERE id = 1
But I'd like to make it in 1 to leverage DB power, not JS.
Is there a simple way to do it? JOIN
doesn't seem to allow me building this kind of object.