我有一个像
这样的查询SELECT
SM.*
FROM sorted_stop_master AS SM
INNER JOIN route_master AS RM
ON SM.station_code = RM.station_code
WHERE RM.route_code = '102D'
AND SM.COMPANY_CODE = '0103'
ORDER BY CAST(RM.sequence_no AS int);
这会返回数据,但它包含重复记录。我想删除具有相同查询的重复行..
请帮我编辑查询..我尝试了一些修改,但没有成功。
答案 0 :(得分:0)
试试这个?
SELECT DISTINCT SM.*
FROM sorted_stop_master AS SM
INNER JOIN route_master AS RM ON SM.station_code = RM.station_code
where RM.route_code= "102D"
AND SM.COMPANY_CODE='0103'
ORDER BY CAST(RM.sequence_no as INT);