aboutsummaryrefslogtreecommitdiff
path: root/res/sql/orcl_all.sql
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2015-02-08 20:06:39 +0100
committerPacien TRAN-GIRARD2015-02-08 20:06:39 +0100
commit4496e089bca542fc98bfad0e005469211e7cbc1e (patch)
tree8e8473f34d339468eaceb42cee97a9db7f60770e /res/sql/orcl_all.sql
parentc00cb6ae05f548f7ae270a93ad44f57207380406 (diff)
downloadminibay-4496e089bca542fc98bfad0e005469211e7cbc1e.tar.gz
Implement current sales listing
Diffstat (limited to 'res/sql/orcl_all.sql')
-rw-r--r--res/sql/orcl_all.sql4
1 files changed, 4 insertions, 0 deletions
diff --git a/res/sql/orcl_all.sql b/res/sql/orcl_all.sql
index 08015f4..b3b4072 100644
--- a/res/sql/orcl_all.sql
+++ b/res/sql/orcl_all.sql
@@ -173,11 +173,13 @@ CREATE OR REPLACE VIEW sales AS
173 173
174 SELECT 174 SELECT
175 items.uuid AS item_uuid, 175 items.uuid AS item_uuid,
176 items.item_name AS item_name,
176 items.user_uuid AS seller_uuid, 177 items.user_uuid AS seller_uuid,
177 items.start_date AS start_date, 178 items.start_date AS start_date,
178 items.end_date AS end_date, 179 items.end_date AS end_date,
179 best_bids.uuid AS best_bid_uuid, 180 best_bids.uuid AS best_bid_uuid,
180 best_bids.user_uuid AS best_bidder_uuid, 181 best_bids.user_uuid AS best_bidder_uuid,
182 items.initial_price AS initial_price,
181 best_bids.offer AS best_offer, 183 best_bids.offer AS best_offer,
182 COALESCE(charges.fee, 0) + COALESCE(charges.rate, 0) * best_bids.offer AS charges 184 COALESCE(charges.fee, 0) + COALESCE(charges.rate, 0) * best_bids.offer AS charges
183 185
@@ -218,6 +220,8 @@ CREATE OR REPLACE VIEW sales AS
218 GROUP BY charges.start_date, charges.end_date 220 GROUP BY charges.start_date, charges.end_date
219 ) charges 221 ) charges
220 ON items.end_date BETWEEN charges.start_date AND charges.end_date; 222 ON items.end_date BETWEEN charges.start_date AND charges.end_date;
223
224
221CREATE OR REPLACE VIEW accounts AS 225CREATE OR REPLACE VIEW accounts AS
222 226
223 SELECT 227 SELECT