Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php |
— | — | @@ -937,18 +937,18 @@ |
938 | 938 | $options .= ' OFFSET ' . $requestoptions->offset; |
939 | 939 | } |
940 | 940 | // NOTE: the query needs to do the fitlering of internal properties, else LIMIT is wrong |
941 | | - $res = $db->query('(SELECT smw_id, smw_title, COUNT(*) as count, smw_sortkey FROM ' . |
| 941 | + $res = $db->query('(SELECT smw_id, smw_title, smw_sortkey, COUNT(*) as count FROM ' . |
942 | 942 | $db->tableName('smw_rels2') . ' INNER JOIN ' . $db->tableName('smw_ids') . ' ON p_id=smw_id WHERE smw_iw=' . |
943 | | - $db->addQuotes('') . ' OR smw_iw=' . $db->addQuotes(SMW_SQL2_SMWPREDEFIW) . ' GROUP BY smw_id) UNION ' . |
| 943 | + $db->addQuotes('') . ' OR smw_iw=' . $db->addQuotes(SMW_SQL2_SMWPREDEFIW) . ' GROUP BY smw_id,smw_title,smw_sortkey) UNION ' . |
944 | 944 | '(SELECT smw_id, smw_title, COUNT(*) as count, smw_sortkey FROM ' . |
945 | 945 | $db->tableName('smw_spec2') . ' INNER JOIN ' . $db->tableName('smw_ids') . ' ON p_id=smw_id WHERE smw_iw=' . |
946 | | - $db->addQuotes('') . ' OR smw_iw=' . $db->addQuotes(SMW_SQL2_SMWPREDEFIW) . ' GROUP BY smw_id) UNION ' . |
| 946 | + $db->addQuotes('') . ' OR smw_iw=' . $db->addQuotes(SMW_SQL2_SMWPREDEFIW) . ' GROUP BY smw_id,smw_title,smw_sortkey) UNION ' . |
947 | 947 | '(SELECT smw_id, smw_title, COUNT(*) as count, smw_sortkey FROM ' . |
948 | 948 | $db->tableName('smw_atts2') . ' INNER JOIN ' . $db->tableName('smw_ids') . ' ON p_id=smw_id WHERE smw_iw=' . |
949 | | - $db->addQuotes('') . ' OR smw_iw=' . $db->addQuotes(SMW_SQL2_SMWPREDEFIW) . ' GROUP BY smw_id) UNION ' . |
| 949 | + $db->addQuotes('') . ' OR smw_iw=' . $db->addQuotes(SMW_SQL2_SMWPREDEFIW) . ' GROUP BY smw_id,smw_title,smw_sortkey) UNION ' . |
950 | 950 | '(SELECT smw_id, smw_title, COUNT(*) as count, smw_sortkey FROM ' . |
951 | 951 | $db->tableName('smw_text2') . ' INNER JOIN ' . $db->tableName('smw_ids') . ' ON p_id=smw_id WHERE smw_iw=' . |
952 | | - $db->addQuotes('') . ' OR smw_iw=' . $db->addQuotes(SMW_SQL2_SMWPREDEFIW) . ' GROUP BY smw_id) ' . $options, |
| 952 | + $db->addQuotes('') . ' OR smw_iw=' . $db->addQuotes(SMW_SQL2_SMWPREDEFIW) . ' GROUP BY smw_id,smw_title,smw_sortkey) ' . $options, |
953 | 953 | 'SMW::getPropertySubjects'); |
954 | 954 | $result = array(); |
955 | 955 | while($row = $db->fetchObject($res)) { |