mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-03-28 17:55:06 +00:00
Fix query to also work with mariadb
This commit is contained in:
parent
5f32eadaba
commit
cc16b0c024
@ -31,15 +31,15 @@ object QCollective {
|
||||
val fileSize = sql"""
|
||||
select sum(length) from (
|
||||
with attachs as
|
||||
(select a.attachid as aid, a.filemetaid as fid
|
||||
from attachment a
|
||||
inner join item i on a.itemid = i.itemid
|
||||
where i.cid = $coll)
|
||||
(select a.fid,m.length from attachs a
|
||||
inner join filemeta m on m.id = a.fid
|
||||
union
|
||||
select a.file_id,m.length from attachment_source a
|
||||
inner join filemeta m on m.id = a.file_id where a.id in (select aid from attachs))
|
||||
(select a.attachid as aid, a.filemetaid as fid
|
||||
from attachment a
|
||||
inner join item i on a.itemid = i.itemid
|
||||
where i.cid = $coll)
|
||||
select a.fid,m.length from attachs a
|
||||
inner join filemeta m on m.id = a.fid
|
||||
union distinct
|
||||
select a.file_id,m.length from attachment_source a
|
||||
inner join filemeta m on m.id = a.file_id where a.id in (select aid from attachs)
|
||||
) as t""".query[Option[Long]].unique
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user