多表关联时视图查出重复数据问题


多表关联时本身有一条数据,但是视图查出重复数据用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