aboutsummaryrefslogtreecommitdiff
path: root/res/sql/pg_all.sql
diff options
context:
space:
mode:
Diffstat (limited to 'res/sql/pg_all.sql')
-rw-r--r--res/sql/pg_all.sql4
1 files changed, 4 insertions, 0 deletions
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
164 164
165 SELECT 165 SELECT
166 items.uuid AS item_uuid, 166 items.uuid AS item_uuid,
167 items.item_name AS item_name,
167 items.user_uuid AS seller_uuid, 168 items.user_uuid AS seller_uuid,
168 items.start_date AS start_date, 169 items.start_date AS start_date,
169 items.end_date AS end_date, 170 items.end_date AS end_date,
170 best_bids.uuid AS best_bid_uuid, 171 best_bids.uuid AS best_bid_uuid,
171 best_bids.user_uuid AS best_bidder_uuid, 172 best_bids.user_uuid AS best_bidder_uuid,
173 items.initial_price AS initial_price,
172 best_bids.offer AS best_offer, 174 best_bids.offer AS best_offer,
173 COALESCE(charges.fee, 0) + COALESCE(charges.rate, 0) * best_bids.offer AS charges 175 COALESCE(charges.fee, 0) + COALESCE(charges.rate, 0) * best_bids.offer AS charges
174 176
@@ -192,6 +194,8 @@ CREATE OR REPLACE VIEW sales AS
192 GROUP BY charges.start_date, charges.end_date 194 GROUP BY charges.start_date, charges.end_date
193 ) charges 195 ) charges
194 ON items.end_date BETWEEN charges.start_date AND charges.end_date; 196 ON items.end_date BETWEEN charges.start_date AND charges.end_date;
197
198
195CREATE OR REPLACE VIEW accounts AS 199CREATE OR REPLACE VIEW accounts AS
196 200
197 SELECT 201 SELECT