View | Details | Raw Unified | Return to bug 15877
Collapse All | Expand All

(-)a/C4/Barcodes/annual.pm (-3 / +2 lines)
Lines 38-45 BEGIN { Link Here
38
38
39
sub db_max ($;$) {
39
sub db_max ($;$) {
40
	my $self = shift;
40
	my $self = shift;
41
	my $query = "SELECT max(substring_index(barcode,'-',-1)) AS chunk,barcode FROM items WHERE barcode LIKE ? GROUP BY barcode";
41
	my $query = "SELECT substring_index(barcode,'-',-1) AS chunk,barcode FROM items WHERE barcode LIKE ? ORDER BY chunk DESC LIMIT 1";
42
		# FIXME: unreasonably expensive query on large datasets
42
		# FIXME: unreasonably expensive query on large datasets (I think removal of group by does this?)
43
	my $sth = C4::Context->dbh->prepare($query);
43
	my $sth = C4::Context->dbh->prepare($query);
44
	my ($iso);
44
	my ($iso);
45
	if (@_) {
45
	if (@_) {
46
- 

Return to bug 15877