define "nav"
我想通过shrn_trpr_nm进行组织,我该怎么办?
答案 0 :(得分:0)
要同时返回其他列,您还必须获取其汇总版本,例如max()
:
SELECT
max(ptl_id) ptl_id, -- use max()
max(chnl_id) chnl_id,
max(shrn_srno) shrn_srno,
shrn_trpr_nm
FROM schd_shrn_infm
WHERE ptl_id = 'PTL_51'
AND chnl_id = 'CHNL_1'
AND schd_srno = 100000001480
GROUP BY shrn_trpr_nm -- add this line
ORDER BY shrn_trpr_nm
LIMIT 10
由于其他列是通过WHERE
子句修复的列,max()
会没问题。
答案 1 :(得分:-1)
无法低估问题在哪里
只需将字段放在订单和组
中SELECT
ptl_id,chnl_id, shrn_srno, shrn_trpr_nm
FROM WHERE
ptl_id = 'PTL_51'
AND chnl_id = 'CHNL_1'
AND schd_srno = 100000001480
GROUP BY
shrn_trpr_nm
ORDER BY
shrn_trpr_nm
LIMIT 10