Hi,

you have 2 tables in your query that both have a biblionumber column:
items and biblio.

So in your query, you need to specifiy which table is meant by adding
the name of the table it should use:

SELECT CONCAT('<a href=\"/cgi-bin/koha/cataloguing/
additem.pl?op=edititem&biblionumber=', biblio.biblionumber,
'&itemnumber=', itemnumber, '#edititem', '\">', itemnumber, '</a>' ) AS
itemnumber,items.itemcallnumber,items.barcode,biblio.author,biblio.title,items.price

...


Hope this helps,


Katrin

On 29.05.20 14:20, muiru james wrote:
Hello Mark,

Following up on this query, this is the whole SQL query

SELECT CONCAT('<a href=\"/cgi-bin/koha/cataloguing/
additem.pl?op=edititem&biblionumber=', biblionumber, '&itemnumber=',
itemnumber, '#edititem', '\">', itemnumber, '</a>' ) AS
itemnumber,items.itemcallnumber,items.barcode,biblio.author,biblio.title,items.price

FROM items
LEFT JOIN biblioitems on
(items.biblioitemnumber=biblioitems.biblioitemnumber)
LEFT JOIN biblio on (biblioitems.biblionumber=biblio.biblionumber)
WHERE items.barcode NOT LIKE 'K%'
AND  items.barcode NOT LIKE 'A%'
AND items.barcode NOT LIKE 'B%'
AND items.itype=<<itype|itemtypes>>
ORDER BY items.itemcallnumber asc

The error is as under:

*The following error was encountered:*
The database returned the following error:
Column 'biblionumber' in field list is ambiguous
Please check the log for further details.
Return to previous page
<http://127.0.1.1:8080/cgi-bin/koha/reports/guided_reports.pl?reports=37&phase=Run+this+report&param_name=itype%7Citemtypes&sql_params=BK#>

If I remove author and title fields, the report runs well. I however would
need the two fields.

Warm Regards

On Tue, May 19, 2020 at 2:28 PM Mark Alexander <ma...@pobox.com> wrote:

Excerpts from muirunyeri's message of 2020-05-19 11:10:33 +0300:
However if anybody would help me understand why I get an error
(biblionumber is ambiguous) after adding any field from biblio table I'd be
really grateful. This after correctly adding a left join for the biblios
table using biblionumber on itemnumber in items.

It would help if you could post your entire query.  But my guess is
that the ambiguity is the result of joining two tables that have
fields with the same name.  The items and biblio tables both have a
field called biblionumber.  So in your query, you have to fix the
ambiguity by using the table name as a prefix: e.g.,
items.biblionumber or biblio.biblionumber .
_______________________________________________

Koha mailing list  http://koha-community.org
Koha@lists.katipo.co.nz
Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha

_______________________________________________

Koha mailing list  http://koha-community.org
Koha@lists.katipo.co.nz
Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
_______________________________________________

Koha mailing list  http://koha-community.org
Koha@lists.katipo.co.nz
Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha

Reply via email to