有关fj的疑问

第一部分:

test_fj = fj(t_test_821, t_test, `trade_date `strategy_id `secu_code)
select * from test_fj where trade_date=2019.08.27 and strategy_id=5026

第二部分:

ttt1 = select * from t_test_821 where trade_date=2019.08.27 and strategy_id=5026
ttt2 = select * from t_test where trade_date=2019.08.27 and strategy_id=5026
fj(ttt1, ttt2, `trade_date `strategy_id `secu_code)

 `trade_date`strategy_id`secu_code 这三个字段是连接字段,为什么fj在这三个字段上不是取并集而是仍旧只含左表的内容?

请先 登录 后评论

1 个回答

wale

如果您把第二部分的语句换成

ttt1 = select * from t_test_821 where  trade_date= 2019.08.27 and strategy_id = 5026
ttt2 = select * from t_test where  trade_date= 2019.08.27 and strategy_id = 5026
select * from fj(ttt1, ttt2, `trade_date`strategy_id`secu_code) where  trade_date= 2019.08.27 and strategy_id = 5026

才是完全相等的;

或者这样筛选,能把最后一条记录也包括进来

select * from test_fj where  (trade_date= 2019.08.27 and strategy_id = 5026) or (t_test_trade_date=2019.08.27 and t_test_strategy_id=5026)
请先 登录 后评论