SELECT `s` . * , `f` . `fileid` , `f` . `path` , `st` . `id` AS `storage_string_id` FROM `oc_share` `s` LEFT JOIN `oc_filecache` `f` ON `s` . `file_source` = `f` . `fileid` LEFT JOIN `oc_storages` `st` ON `f` . `storage` = `st` . `numeric_id` WHERE ( `file_source` = ? ) AND ( `share_type` = ? ) AND ( `share_with` IN (...) ) AND ( ( `item_type` = ? ) OR ( `item_type` = ? ) ) ORDER BY `s` . `id` ASC