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

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

Return to bug 15877