-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDB.sqbpro
More file actions
37 lines (18 loc) · 2.23 KB
/
Copy pathDB.sqbpro
File metadata and controls
37 lines (18 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?xml version="1.0" encoding="UTF-8"?><sqlb_project><db path="C:/Users/viktoriiap/Documents/Python alert/DB.db" readonly="0" foreign_keys="1" case_sensitive_like="0" temp_store="0" wal_autocheckpoint="1000" synchronous="2"/><attached/><window><main_tabs open="structure browser pragmas query" current="1"/></window><tab_structure><column_width id="0" width="300"/><column_width id="1" width="0"/><column_width id="2" width="150"/><column_width id="3" width="1874"/><column_width id="4" width="0"/><expanded_item id="0" parent="1"/><expanded_item id="1" parent="1"/><expanded_item id="2" parent="1"/><expanded_item id="3" parent="1"/></tab_structure><tab_browse><current_table name="4,12:mainTransactions"/><default_encoding codec=""/><browse_table_settings><table schema="main" name="Orders" show_row_id="0" encoding="" plot_x_axis="" unlock_view_pk="_rowid_"><sort/><column_widths><column index="1" value="99"/><column index="2" value="224"/><column index="3" value="141"/></column_widths><filter_values/><conditional_formats/><row_id_formats/><display_formats/><hidden_columns/><plot_y_axes/><global_filter/></table><table schema="main" name="Transactions" show_row_id="0" encoding="" plot_x_axis="" unlock_view_pk="_rowid_"><sort/><column_widths><column index="1" value="158"/><column index="2" value="195"/><column index="3" value="184"/><column index="4" value="99"/><column index="5" value="200"/></column_widths><filter_values/><conditional_formats/><row_id_formats/><display_formats/><hidden_columns/><plot_y_axes/><global_filter/></table></browse_table_settings></tab_browse><tab_sql><sql name="SQL 1">
SELECT
count(hanging_orders.order_id) as hanging_orders_count,
o.merchant_id
from (SELECT DISTINCT order_id
from Transactions
where
datetime(created_date) < strftime('%Y-%m-%d %H:%M:%S', 'now', '-7 days')
and datetime(created_date) > strftime('%Y-%m-%d %H:%M:%S', 'now', '-10 days')
and transaction_type = 'auth'
EXCEPT
SELECT DISTINCT order_id
from Transactions
where datetime(created_date) > strftime('%Y-%m-%d %H:%M:%S', 'now', '-7 days')
and transaction_type != 'auth') as hanging_orders
join Orders o on o.order_id = hanging_orders.order_id
group by o.merchant_id
</sql><current_tab id="0"/></tab_sql></sqlb_project>