I have a schema that is setup as so:
Cards (card_id, fact_id, fact_view_id)
data_for_fact (fact_id, key, value)
Sample data:
[cards]: (51, 1, '2::1'), (52, 1, '2::2') ...
[data_for_fact]: (1, 'q', 'person'), (1, 'a', 'noun')
The intended output is:
[cards]: (51, 'person' (as q), 'noun' (as a)),
(52, 'noun' (as q), 'person' (as a))
With SQL Lite, how can I get the output that I’m looking for?
I’ve tried creating a join, but that only works on the first output card. The difference between the two cards are the fact_view id.
You could do it with a union:
Or you could use
CASEexpressions: