diff --git a/daemon/table/cs-entry-impl.cpp b/daemon/table/cs-entry-impl.cpp
index c97d692..9e1c1cd 100644
--- a/daemon/table/cs-entry-impl.cpp
+++ b/daemon/table/cs-entry-impl.cpp
@@ -61,6 +61,38 @@
   this->setData(this->getData(), false);
 }
 
+int
+compareQueryWithData(const Name& queryName, const Data& data)
+{
+  bool queryIsFullName = !queryName.empty() && queryName[-1].isImplicitSha256Digest();
+
+  int cmp = queryIsFullName ?
+            queryName.compare(0, queryName.size() - 1, data.getName()) :
+            queryName.compare(data.getName());
+
+  if (cmp != 0) { // Name without digest differs
+    return cmp;
+  }
+
+  if (queryIsFullName) { // Name without digest equals, compare digest
+    return queryName[-1].compare(data.getFullName()[-1]);
+  }
+  else { // queryName is a proper prefix of Data fullName
+    return -1;
+  }
+}
+
+int
+compareDataWithData(const Data& lhs, const Data& rhs)
+{
+  int cmp = lhs.getName().compare(rhs.getName());
+  if (cmp != 0) {
+    return cmp;
+  }
+
+  return lhs.getFullName()[-1].compare(rhs.getFullName()[-1]);
+}
+
 bool
 EntryImpl::operator<(const EntryImpl& other) const
 {
@@ -69,15 +101,15 @@
       return m_queryName < other.m_queryName;
     }
     else {
-      return m_queryName < other.m_queryName;
+      return compareQueryWithData(m_queryName, other.getData()) < 0;
     }
   }
   else {
     if (other.isQuery()) {
-      return this->getFullName() < other.m_queryName;
+      return compareQueryWithData(other.m_queryName, this->getData()) > 0;
     }
     else {
-      return this->getFullName() < other.getFullName();
+      return compareDataWithData(this->getData(), other.getData()) < 0;
     }
   }
 }
