ERROR: column reference "b_id" is ambiguous
I know that this error means that you need to change somewhere b_id, but something I can not understand where.
Here is the query:
SELECT "b_id","b_genre","b_author","b_book_name","b_page_count","at_text","bc_name" FROM "book" LEFT JOIN "annotation" ON "b_id"="at_bid" LEFT JOIN "book_cover" ON "bc_book_id"="b_id" LEFT JOIN (SELECT "b_id" FROM "book" ORDER BY "b_id" DESC OFFSET 10 LIMIT 10 ) as t ON t.b_id = "book".b_id The error that falls out:
ERROR: column reference "b_id" is ambiguous LINE 1: SELECT "b_id","b_genre","b_author","b_book_name","b_page_cou... ^ This is what I use as offset, limit, because if you use direct offset and limit, the request hangs specifically, there are a lot of records.
LEFT JOIN (SELECT "b_id" FROM "book" ORDER BY "b_id" DESC OFFSET 10 LIMIT 10 ) PostgreSQL 9.3.11 database
tablename.b_idmost likely, everything will work out - splash58LEFT JOIN (SELECT "b_id" FROM "book" ORDER BY "b_id" DESC OFFSET 10 LIMIT 10 ) as t ON t.b_id = "book".b_iddoes not affect the query at all. because from the first book entries will be selected regardless of what is in this subquery. For left it works that way. - Mike