[Koha] SQL report help

Nicole Engard nengard at gmail.com
Sat Nov 27 04:47:00 NZDT 2010


Marlene,

I'm happy to help, next time though email the entire list so they can
all benefit from my answer.

Try this:

SELECT borrowers.surname, borrowers.firstname, borrowers.cardnumber,
borrower_attributes.code, borrower_attributes.attribute FROM borrowers
LEFT JOIN borrower_attributes ON
(borrowers.borrowernumber=borrower_attributes.borrowernumber) LEFT
JOIN borrower_attribute_types ON
(borrower_attribute_types.code=borrower_attributes.code) group by
borrower_attributes.attribute order by borrowers.surname,
borrowers.firstname asc

It doesn't format the report the way you want but it does give you the
info you're looking for.

Thanks
Nicole

On Fri, Nov 26, 2010 at 10:35 AM, marlene <marlene.delhaye at gmail.com> wrote:
> Hello,
>
> I just found your sql report about patron attributes :
> Patrons with Attribute Value
>    * Developer: Nicole C. Engard, ByWater Solutions
>    * Module: Patrons
>    * Purpose: Patron list with the value of one of their custom
> patron attributes (student id)
>    * Status: Complete
>
> SELECT borrowers.surname, borrowers.firstname,
>       borrowers.cardnumber, borrower_attributes.attribute AS 'Student ID'
> FROM borrowers
> LEFT JOIN borrower_attributes ON
> (borrowers.borrowernumber=borrower_attributes.borrowernumber)
> LEFT JOIN borrower_attribute_types ON
> (borrower_attribute_types.code=borrower_attributes.code)
> WHERE borrower_attributes.code = 'STUID'
>
> My problem is that I want to list all the attributes of my patrons, this way :
> borrower number | surname | firstname | attribute 1 | attribute 2 |
> attribute 3 | ...
> My goal is to get the most comprehensive list from SQL, so that I can
> do more complicated things with excel afterwards.
> So, do you have an idea of how to deal with several attributes ?
>
> Thanks a lot for what you do for OSS anyway,
>
> Best regards,
>
> Marlène Delhaye
> Koha administrator for Université Paul Cézanne Aix-Marseille 3, France
>
> aim/Y! : ebibliothecaire
> fb : http://www.facebook.com/marlenedelhaye
> ff : http://friendfeed.com/marlened
> twitter : http://twitter.com/marlened
> blog : http://marlenescorner.net/
> old blog : http://www.biblioacid.org/
>


More information about the Koha mailing list