Skip to Main Content
mccbannerMiddlesex Community College Home Page Current Students Future Students Programs & Courses Paying for College Workforce & Training” title= Alumni Library My MCC Apply Registration Directory Give to MCC About Contact Us

Higher Education Libraries of Massachusetts: SQL

Select

Select - list here the fields you are looking at

Where

Select a specific branch

WHERE item.homebranch=<<Home branch|branches>>

Where homebranch = 'MCC_B'

When searching for a multi-campus branch

where homebranch like 'mcc%'

 

Date range

WHERE date_due BETWEEN <<Start date|date>> AND <<End date|date>>

AS

SQL aliases are used to give a table, or a column in a table, a temporary name especially when the table name.fieldname is quite long.

Group by

Group by branch and then itype

group by homebranch, itype

Order by

ORDER by homebranch, itype

For lost, missing, lost and paid values sort by when the value changed
ORDER BY i.itemlost_on, i.homebranch 

Sort by:

Item call number in ascending order
ORDER BY i.cn_sort ASC

Borrowers table

Date accessed from borrowers (create patron record created)

 

Schema Tables of Interest

Union

The SQL UNION clause/operator is used to combine the results of two or more SELECT statements without returning any duplicate rows.

UNION All however will allow duplicates

Link

Link-allows you to enter a clickable link into the report

-- Show bib record by having a clickable link to bib record it can be edited if need be
CONCAT
('<a href=\"/cgi-bin/koha/catalogue/detail.pl?biblionumber=', biblionumber, '\">', biblionumber, '</a>' ) AS biblionumber,

Bedford Campus Lowell Campus Accessibility Policy Statement Affirmative Action Statement Privacy Policy Facebook Twitter YouTube Pinterest Instagram Linkedin Get ADOBE Reader