ambiguous column name: id

Hello, I have an exporter on my User relation manager. sometimes when I export, it fails with the following error:
General error: 1 ambiguous column name: id (Connection: sqlite, SQL:
General error: 1 ambiguous column name: id (Connection: sqlite, SQL:
select distinct "users"."id" from "users" inner join "course_user" on "users"."id" = "course_user"."user_id" where "course_user"."course_id" = 1 order by "users"."id" asc, "id" asc limit 1000)
select distinct "users"."id" from "users" inner join "course_user" on "users"."id" = "course_user"."user_id" where "course_user"."course_id" = 1 order by "users"."id" asc, "id" asc limit 1000)
Solution:
I couldn't figure out how to change the query on the exporter to change the order by clause, so I removed the normal exportAction entirely and kept only the bulkAction which doesn't attempt to sort the results
Jump to solution
2 Replies
micraux
micraux6mo ago
Hello, The error is at the end of your request ..."id" asc limit 1000). The request doesn't know which table id belongs to. I suppose you want to order by Users id then by Course_User id: if so, your request should end with ..."course_user"."id" asc limit 1000).
Solution
King Dice
King Dice6mo ago
I couldn't figure out how to change the query on the exporter to change the order by clause, so I removed the normal exportAction entirely and kept only the bulkAction which doesn't attempt to sort the results
Want results from more Discord servers?
Add your server