aboutsummaryrefslogtreecommitdiff
path: root/res/sql
diff options
context:
space:
mode:
Diffstat (limited to 'res/sql')
-rw-r--r--res/sql/orcl_all.sql4
-rw-r--r--res/sql/pg_all.sql4
-rw-r--r--res/sql/views/orcl_sales.sql2
-rw-r--r--res/sql/views/pg_sales.sql2
4 files changed, 12 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
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
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
2 2
3 SELECT 3 SELECT
4 items.uuid AS item_uuid, 4 items.uuid AS item_uuid,
5 items.item_name AS item_name,
5 items.user_uuid AS seller_uuid, 6 items.user_uuid AS seller_uuid,
6 items.start_date AS start_date, 7 items.start_date AS start_date,
7 items.end_date AS end_date, 8 items.end_date AS end_date,
8 best_bids.uuid AS best_bid_uuid, 9 best_bids.uuid AS best_bid_uuid,
9 best_bids.user_uuid AS best_bidder_uuid, 10 best_bids.user_uuid AS best_bidder_uuid,
11 items.initial_price AS initial_price,
10 best_bids.offer AS best_offer, 12 best_bids.offer AS best_offer,
11 COALESCE(charges.fee, 0) + COALESCE(charges.rate, 0) * best_bids.offer AS charges 13 COALESCE(charges.fee, 0) + COALESCE(charges.rate, 0) * best_bids.offer AS charges
12 14
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
2 2
3 SELECT 3 SELECT
4 items.uuid AS item_uuid, 4 items.uuid AS item_uuid,
5 items.item_name AS item_name,
5 items.user_uuid AS seller_uuid, 6 items.user_uuid AS seller_uuid,
6 items.start_date AS start_date, 7 items.start_date AS start_date,
7 items.end_date AS end_date, 8 items.end_date AS end_date,
8 best_bids.uuid AS best_bid_uuid, 9 best_bids.uuid AS best_bid_uuid,
9 best_bids.user_uuid AS best_bidder_uuid, 10 best_bids.user_uuid AS best_bidder_uuid,
11 items.initial_price AS initial_price,
10 best_bids.offer AS best_offer, 12 best_bids.offer AS best_offer,
11 COALESCE(charges.fee, 0) + COALESCE(charges.rate, 0) * best_bids.offer AS charges 13 COALESCE(charges.fee, 0) + COALESCE(charges.rate, 0) * best_bids.offer AS charges
12 14