Avoid duplicate search results by using SELECT DISTINCT when filling the SEARCH_EVENT...
authorgregor herrmann <gregoa@debian.org>
Fri, 8 Jul 2011 14:19:39 +0000 (14:19 +0000)
committergregor herrmann <gregoa@debian.org>
Fri, 8 Jul 2011 14:19:39 +0000 (14:19 +0000)
src/sql/sqlengine.cpp

index 5e60826..f11ead7 100644 (file)
@@ -302,7 +302,7 @@ int SqlEngine::searchEvent(int aConferenceId, const QHash<QString,QString> &aCol
     execQuery( db, "CREATE TABLE SEARCH_EVENT ( xid_conference INTEGER  NOT NULL, id INTEGER NOT NULL )");
     // INSERT
     QString sql = QString("INSERT INTO SEARCH_EVENT ( xid_conference, id ) "
-                "SELECT EVENT.xid_conference, EVENT.id FROM EVENT ");
+                "SELECT DISTINCT EVENT.xid_conference, EVENT.id FROM EVENT ");
     if( aColumns.contains("ROOM") ){
         sql += "INNER JOIN EVENT_ROOM ON ( EVENT.xid_conference = EVENT_ROOM.xid_conference AND EVENT.id = EVENT_ROOM.xid_event ) ";
         sql += "INNER JOIN ROOM ON ( EVENT_ROOM.xid_room = ROOM.id ) ";