Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Everyone,
I have the below scenario. I have table A with sales information and i have table B with promotions information. Based on the price in sales table i want to appy the promotion. I want to get the result which is shown in final table. In oracle ,to get this result i can simply write the following query. Do we have any easy way to get this result using QV script.
Oracle Script to get the final result:
select A*,B.Promotion
from sales A,Promotions B
where A.Price between B.Min Price and B.Max Price;
Sales table | |
Itemno | price |
1 | 10 |
2 | 20 |
3 | 10 |
4 | 30 |
Promotions table | ||
Min Price | Max Price | Promotion |
1 | 10 | $2 Rebate |
11 | 30 | Free shipping |
Final Table | ||
Itemno | price | Promotion |
1 | 10 | $2 Rebate |
2 | 20 | Free shipping |
3 | 10 | $2 Rebate |
4 | 30 | Free shipping |
im new in QV. but you can try like this one.
sales table:
load * from sales_table;
promotion_table:
load * promotion_table;
intervalmatch:
intervalmatch(price)
load minprice,
maxprice
resident promotion_table;
left join(sales_table) load * resident intervalmatch;
left join(sales_table) load * resident promotion_table;
im new in QV. but you can try like this one.
sales table:
load * from sales_table;
promotion_table:
load * promotion_table;
intervalmatch:
intervalmatch(price)
load minprice,
maxprice
resident promotion_table;
left join(sales_table) load * resident intervalmatch;
left join(sales_table) load * resident promotion_table;
Excellent. The solution worked fine. Thank you verymuch.