         "       structure.parent AS _parent " +
         "FROM (\(either)) AS structure JOIN (\(values)) AS vals " +
         "ON vals.guid = structure.guid " +
-        exclusion
+        "WHERE " + exclusion
 
         let withIcon =
         "SELECT bookmarks.id AS id, bookmarks.guid AS guid, bookmarks.type AS type, " +

            switch type {
            case .Bookmark:
                return itemFactory(row)
            case .Folder:
                return folderFactory(row)
            case .DynamicContainer:
                fallthrough
            case .Separator:
                return separatorFactory(row)
            case .Livemark:
                return livemarkFactory(row)
            case .Query:
                return queryFactory(row)
            }
        }

        return bookmark
    }

    // We ignore queries altogether inside the model factory.
    private class func queryFactory(row: SDRow) -> BookmarkItem {
        log.warning("Creating a BookmarkItem from a query. This is almost certainly unexpected.")
        let id = row["id"] as! Int
        let guid = row["guid"] as! String
        let title = row["title"] as? String ?? SQLiteBookmarks.defaultItemTitle
        let bookmark = BookmarkItem(guid: guid, title: title, url: "about:blank")
        bookmark.id = id
        BookmarkFactory.addIcon(bookmark, row: row)
        return bookmark
