I am trying to make a SQLITE3 query that joins two tables and then groups results together without losing columns.
Table A is a normal table, and Table B is supposed to be a dynamic array that Table A can use.
I am trying to get something like this to output a_attr1|a_attr2|a_attr3|b_index1|b_value1|b_index2|b_value2|b_index3|b_value3
Instead I am getting... a_attr1|a_attr2|a_attr3|b_index3|b_value3
Any idea how I can tweak my query to do that?
CREATE TABLE A
(
a_id INTEGER PRIMARY KEY UNIQUE,
a_attr1 INTEGER,
a_attr2 INTEGER,
a_attr3 VARCHAR,
);
CREATE TABLE B
(
a_id INTEGER,
b_index INTEGER,
b_value INTEGER
);
CREATE VIEW myView AS
SELECT a_attr1, a_attr2, a_attr3, b_index, b_value
FROM A AS A
LEFT JOIN B AS B ON A.a_id = B.a_id
GROUP BY A.a_id;
Aucun commentaire:
Enregistrer un commentaire