我一直在试图弄清楚如何修改此查询,以便结果集不包含numHits。我想以相同的顺序得到相同的结果,只是没有包含numHits。按列排序但在结果中不包括该列
SELECT
`newel_inventoryKeywordIdDictionaryId`.`inventoryId`
,COUNT(`newel_inventoryKeywordIdDictionaryId`.`inventoryId`) as numHits
FROM
`newel_inventoryKeywordIdDictionaryId`
, `newel_inventoryDictionary`
WHERE
`newel_inventoryKeywordIdDictionaryId`.`dicId` = `newel_inventoryDictionary`.`dicId`
AND (
`newel_inventoryDictionary`.`word` = 'alabaster' OR `newel_inventoryDictionary`.`word` = 'chess'
)
GROUP BY inventoryId
ORDER BY numHits DESC;
样品的结果:
inventoryId, numHits
6928, 2
6929, 2
6924, 2
6925, 2
13772, 2
6926, 2
18203, 1
6931, 1
13863, 1
18402, 1
期望的结果:
inventoryId
6928
6929
6924
6925
13772
6926
18203
6931
13863
18402
在你选中刚才设置'选择 newel_inventoryKeywordIdDictionaryId.inventoryId'没有'numHits' –