多表關聯時視圖查出重復數據問題


多表關聯時本身有一條數據,但是視圖查出重復數據用distinct可以解決。

如: 

視圖如下

SELECT DISTINCT
t1.station_id as station_id,
t1.tick_sn as tick_sn,
t1.order_id as order_id,
t2.station_name as station_name,
t3.game_id as game_id,

FROM
electric_lottery_report_info t1
LEFT JOIN electric_lottery_station_info t2
ON t1.station_id = t2.station_id
LEFT JOIN electric_lottery_param_info t3
ON t1.game_id = t3.game_id


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM