mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 01:32:38 +00:00
Don't use ORDER BY in VIEWS (as this is invalid SQL, why does this even work sometimes in SQLite) (fixes #33)
This commit is contained in:
parent
4cc2d39063
commit
678579e933
@ -3,4 +3,3 @@ AS
|
||||
SELECT habit_id, MAX(tracked_time) AS last_tracked_time
|
||||
FROM habits_log
|
||||
GROUP BY habit_id
|
||||
ORDER BY MAX(tracked_time) DESC
|
||||
|
@ -3,4 +3,3 @@ AS
|
||||
SELECT battery_id, MAX(tracked_time) AS last_tracked_time
|
||||
FROM battery_charge_cycles
|
||||
GROUP BY battery_id
|
||||
ORDER BY MAX(tracked_time) DESC
|
||||
|
20
migrations/0032.sql
Normal file
20
migrations/0032.sql
Normal file
@ -0,0 +1,20 @@
|
||||
DROP VIEW stock_current;
|
||||
CREATE VIEW stock_current
|
||||
AS
|
||||
SELECT product_id, SUM(amount) AS amount, MIN(best_before_date) AS best_before_date
|
||||
FROM stock
|
||||
GROUP BY product_id;
|
||||
|
||||
DROP VIEW habits_current;
|
||||
CREATE VIEW habits_current
|
||||
AS
|
||||
SELECT habit_id, MAX(tracked_time) AS last_tracked_time
|
||||
FROM habits_log
|
||||
GROUP BY habit_id;
|
||||
|
||||
DROP VIEW batteries_current;
|
||||
CREATE VIEW batteries_current
|
||||
AS
|
||||
SELECT battery_id, MAX(tracked_time) AS last_tracked_time
|
||||
FROM battery_charge_cycles
|
||||
GROUP BY battery_id;
|
Loading…
x
Reference in New Issue
Block a user