【发布时间】:2017-12-14 01:01:42
【问题描述】:
我有两个表,我必须进行连接才能得到这个结果,我使用了这个查询,但是运行需要很长时间,谁能帮助我通过优化查询得到这个结果
SELECT top 10 subs_id, REFILL_VALUE, refill_type, Subscription_type, Category
FROM P_EDW_BO_UNIVERSE.VOUCHER_BY_SUBSCRIBER_DETAIL a , P_EDW_BO_UNIVERSE.offer b
where a.offering_id=b.Offer_ID and DATE_INSERTED = '2017/06/07'
table A
--------
id |name | adresse | number |
1 kh kouba 4586
2 hi bouz 7854
table B
-----------
id | offer
1 post
2 pre
3 pai
我想要这个结果 结果
id | name | adresse | number | offer
1 kh kouba 4586 post
2 hi bouz 7854 pre
【问题讨论】:
-
我对您当前的查询感到困惑,因为您选择了未出现在实际表定义中的列。
-
不要使用旧的连接,它们看起来很讨厌,你的连接上有索引吗?
-
两个表和您的结果中有多少行?什么是 DDL(至少是 PI)? 大量时间究竟是什么?你能解释一下吗?