# HG changeset patch # User Sebastien Jodogne # Date 1681239129 -7200 # Node ID 3cd39c8cade9da7c77bb37ea908eed8c2d3d840e # Parent 91124cc8a8c7004c830c677c3dca9cc408b5f265 sync diff -r 91124cc8a8c7 -r 3cd39c8cade9 Resources/Orthanc/Databases/ISqlLookupFormatter.cpp --- a/Resources/Orthanc/Databases/ISqlLookupFormatter.cpp Tue Apr 11 11:10:19 2023 +0200 +++ b/Resources/Orthanc/Databases/ISqlLookupFormatter.cpp Tue Apr 11 20:52:09 2023 +0200 @@ -383,6 +383,8 @@ } std::list where; + where.push_back(FormatLevel(queryLevel) + ".resourceType = " + + formatter.FormatResourceType(queryLevel) + comparisons); if (!labels.empty()) { @@ -418,12 +420,9 @@ throw OrthancException(ErrorCode_ParameterOutOfRange); } - where.push_back("(SELECT COUNT(1) FROM Labels WHERE internalId = " + FormatLevel(queryLevel) + - ".internalId AND label IN (" + Join(formattedLabels, "", ", ") + ")) " + condition); + where.push_back("(SELECT COUNT(1) FROM Labels AS selectedLabels WHERE selectedLabels.id = " + FormatLevel(queryLevel) + + ".internalId AND selectedLabels.label IN (" + Join(formattedLabels, "", ", ") + ")) " + condition); } - - where.push_back(FormatLevel(queryLevel) + ".resourceType = " + - formatter.FormatResourceType(queryLevel) + comparisons); sql += joins + Join(where, " WHERE ", " AND ");