Skip to content

Commit

Permalink
API: Added views for finding older Price data in the database
Browse files Browse the repository at this point in the history
  • Loading branch information
kfsone committed Sep 5, 2014
1 parent 873133a commit 740f19e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions data/TradeDangerous.sql
Original file line number Diff line number Diff line change
Expand Up @@ -373,4 +373,24 @@ CREATE TABLE Price
) WITHOUT ROWID
;

-- Some views I use now and again.

CREATE VIEW vPriceDataAge AS
SELECT System.name, MIN(Price.modified)
FROM ((System INNER JOIN Station ON System.system_id = Station.system_id)
INNER JOIN Price on Station.station_id = Price.station_id)
GROUP BY 1
ORDER BY 2 DESC
;

CREATE VIEW vOlderData AS
SELECT System.name, MIN(Price.modified)
FROM ((System INNER JOIN Station ON System.system_id = Station.system_id)
INNER JOIN Price on Station.station_id = Price.station_id)
WHERE Price.modified <= DATETIME(CURRENT_TIMESTAMP, '-2 day')
GROUP BY 1
ORDER BY 2 DESC
;


COMMIT;

0 comments on commit 740f19e

Please sign in to comment.