From 4496e089bca542fc98bfad0e005469211e7cbc1e Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Sun, 8 Feb 2015 20:06:39 +0100 Subject: Implement current sales listing --- res/sql/orcl_all.sql | 4 ++++ res/sql/pg_all.sql | 4 ++++ res/sql/views/orcl_sales.sql | 2 ++ res/sql/views/pg_sales.sql | 2 ++ 4 files changed, 12 insertions(+) (limited to 'res/sql') 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 SELECT items.uuid AS item_uuid, + items.item_name AS item_name, items.user_uuid AS seller_uuid, items.start_date AS start_date, items.end_date AS end_date, best_bids.uuid AS best_bid_uuid, best_bids.user_uuid AS best_bidder_uuid, + items.initial_price AS initial_price, best_bids.offer AS best_offer, COALESCE(charges.fee, 0) + COALESCE(charges.rate, 0) * best_bids.offer AS charges @@ -218,6 +220,8 @@ CREATE OR REPLACE VIEW sales AS GROUP BY charges.start_date, charges.end_date ) charges ON items.end_date BETWEEN charges.start_date AND charges.end_date; + + CREATE OR REPLACE VIEW accounts AS SELECT diff --git a/res/sql/pg_all.sql b/res/sql/pg_all.sql index 5d763e0..cecb7ed 100644 --- a/res/sql/pg_all.sql +++ b/res/sql/pg_all.sql @@ -164,11 +164,13 @@ CREATE OR REPLACE VIEW sales AS SELECT items.uuid AS item_uuid, + items.item_name AS item_name, items.user_uuid AS seller_uuid, items.start_date AS start_date, items.end_date AS end_date, best_bids.uuid AS best_bid_uuid, best_bids.user_uuid AS best_bidder_uuid, + items.initial_price AS initial_price, best_bids.offer AS best_offer, COALESCE(charges.fee, 0) + COALESCE(charges.rate, 0) * best_bids.offer AS charges @@ -192,6 +194,8 @@ CREATE OR REPLACE VIEW sales AS GROUP BY charges.start_date, charges.end_date ) charges ON items.end_date BETWEEN charges.start_date AND charges.end_date; + + CREATE OR REPLACE VIEW accounts AS SELECT diff --git a/res/sql/views/orcl_sales.sql b/res/sql/views/orcl_sales.sql index 851d17e..b585819 100644 --- a/res/sql/views/orcl_sales.sql +++ b/res/sql/views/orcl_sales.sql @@ -2,11 +2,13 @@ CREATE OR REPLACE VIEW sales AS SELECT items.uuid AS item_uuid, + items.item_name AS item_name, items.user_uuid AS seller_uuid, items.start_date AS start_date, items.end_date AS end_date, best_bids.uuid AS best_bid_uuid, best_bids.user_uuid AS best_bidder_uuid, + items.initial_price AS initial_price, best_bids.offer AS best_offer, COALESCE(charges.fee, 0) + COALESCE(charges.rate, 0) * best_bids.offer AS charges diff --git a/res/sql/views/pg_sales.sql b/res/sql/views/pg_sales.sql index f36d8e7..f1705f1 100644 --- a/res/sql/views/pg_sales.sql +++ b/res/sql/views/pg_sales.sql @@ -2,11 +2,13 @@ CREATE OR REPLACE VIEW sales AS SELECT items.uuid AS item_uuid, + items.item_name AS item_name, items.user_uuid AS seller_uuid, items.start_date AS start_date, items.end_date AS end_date, best_bids.uuid AS best_bid_uuid, best_bids.user_uuid AS best_bidder_uuid, + items.initial_price AS initial_price, best_bids.offer AS best_offer, COALESCE(charges.fee, 0) + COALESCE(charges.rate, 0) * best_bids.offer AS charges -- cgit v1.2.3