[Koha] Catalogue - SQL Report Help

SATISH lis4satish at gmail.com
Thu Feb 26 18:30:30 NZDT 2015


Hello

Good Morning.

We maintain two item types for books as Books (BK) and Book Bank (BB) just
to accommodate circulation rules/policies.  Reason,  regular students gets
only 2 books from regular stock and reserved students get 2 additional
books from Book Bank along with regular stock (BK).

And am looking for  help for generating unique records (biblio) after
merging both BK and BB. I am trying with following sql, but throwing
errors. Can you please help me over here.
----------------------------------------------------------------------------------------------------------------------------

SELECT DISTINCT b.biblionumber, b.title, b.author, t.editionstatement,
t.publishercode, t.isbn, i.ccode, count(i.itemnumber) FROM biblio b LEFT JOIN
biblioitems t USING(biblionumber) LEFT JOIN items i USING(biblionumber)
WHERE items.itype='BB' AND items.itype='BK' GROUP BY b.biblionumber
---------------------------------------------------------------------

Error:
The database returned the following error:
Unknown column 'items.itype' in 'where clause'

I am not sure how to proceed further.

With Thanks.

Satish MV
Librarian
Govt. Engineering College, Hassan.
Karnataka.
India.

On Sun, Jan 25, 2015 at 2:14 PM, Indranil Das Gupta <indradg at gmail.com>
wrote:

> Hello,
>
> On Sat, Jan 24, 2015 at 1:17 PM, SATISH <lis4satish at gmail.com> wrote:
>
> > can you please help me how to alter this code, so that , It could fetch
> > only non-repeatable/unique records ( by collection code -or- merging all
> > collections codes) only including item types =book and =book bank.
>
> You have answered your own question :) You simply need to insert an
> AND to WHERE clause. Google up basic SQL syntax that should get you
> going.
>
> -idg
>
> --
> Indranil Das Gupta
>
> Phone : +91-98300-20971
> Blog    : http://indradg.randomink.org/blog
> IRC      : indradg on irc://irc.freenode.net
> Twitter : indradg
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-
> Please exchange editable Office documents only in ODF Format. No other
> format is acceptable. Support Open Standards.
>
> For a free editor supporting ODF, please visit LibreOffice -
> http://www.documentfoundation.org
>



--


More information about the Koha mailing list