Author |
Topic |
tushmodgil
Starting Member
2 Posts |
Posted - 2014-06-13 : 06:57:22
|
Kindly help to improve the below mentioned query for faster output. Both tables have 70k rows in it.Create Table tmp_offer_final AsSelect Distinct CUSTOMER_MSISDN, RETAILER_MSISDN, TOPUP_AMOUNT,TOPUP_DATE,COM_PER,card_group,b.offer,b.offer2,b.offer3,b.offer_type,b.Count_sms,a.count_RCFrom final_RECH_COMM_122 a, tmp_promo_map b Where (a.customer_msisdn,a.Retailer_msisdn) In (Selectb.msisdn,b.retailer From tmp_promo_map) And ( a.topup_amount >= b.offer Or a.topup_amount >= b.offer2 Or a.topup_amount >= b.offer3); |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2014-06-13 : 07:10:26
|
The Microsoft SQL Server 2005 equivalent would beSELECT DISTINCT CUSTOMER_MSISDN, RETAILER_MSISDN, TOPUP_AMOUNT, TOPUP_DATE, COM_PER, card_group, b.offer, b.offer2, b.offer3, b.offer_type, b.Count_sms, a.count_RCINTO tmp_offer_finalFROM final_RECH_COMM_122 AS aINNER JOIN tmp_promo_map AS b ON b.retailer = a.Retailer_msisdn AND b.msisdn = a.customer_msisdnWHERE a.topup_amount >= b.offer OR a.topup_amount >= b.offer2 OR a.topup_amount >= b.offer3; Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA |
|
|
tushmodgil
Starting Member
2 Posts |
Posted - 2014-06-13 : 07:47:42
|
B.retailer,b.msisdn needs to be mapped in pair with a.retailer ,a.customer |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2014-06-13 : 14:13:21
|
They are! Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA |
|
|
|
|
|