If you give your id columns unambiguous names to begin with, things will work
out a lot better for you in the long run.
May I suggest the following modification to your tables to remove ambiguity:
CREATE TABLE x(
x_id INTEGER
);
CREATE TABLE y(
y_id INTEGER,
x_id INTEGER REFERENCES x(x_id)
);
SELECT COALESCE(x_id, y_id) AS id
FROM y
LEFT JOIN x USING (x_id)
GROUP BY id;
--
View this message in context:
http://sqlite.1065341.n5.nabble.com/GROUP-BY-ambiguous-column-name-tp78282p78302.html
Sent from the SQLite mailing list archive at Nabble.com.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users