-
Notifications
You must be signed in to change notification settings - Fork 2
/
report.iql
35 lines (32 loc) · 1.12 KB
/
report.iql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* -*- sql -*- */
DECLARE storeurl VARCHAR;
SET storeurl = 'https://markkurossi.com/iql/examples/store.html';
DECLARE ordersurl VARCHAR;
SET ordersurl = 'https://markkurossi.com/iql/examples/orders.csv';
SELECT customers.Name AS Name,
customers.Address AS Address,
products.Name AS Product,
orders.Count AS Count,
products.Price * orders.Count AS Price
FROM (
SELECT c.'.id' AS ID,
c.'.name' AS Name,
c.'.address' AS Address
FROM storeurl FILTER 'table:nth-of-type(1) tr' AS c
WHERE '.id' <> null
) AS customers,
(
SELECT p.'.id' AS ID,
p.'.name' AS Name,
p.'.price' AS Price
FROM storeurl FILTER 'table:nth-of-type(2) tr' AS p
WHERE '.id' <> null
) AS products,
(
SELECT o.'0' AS ID,
o.'1' AS Customer,
o.'2' AS Product,
o.'3' AS Count
FROM ordersurl FILTER 'noheaders' AS o
) AS orders
WHERE orders.Product = products.ID AND orders.Customer = customers.ID;