3
2
1
Commentコメントを追加...
1 回答
- 543
下記SQLで取得できると思います。
DBから初めてデータを抽出する際には良い勉強になるSQLの気がしました。select s.spacename, s.spacekey, c.contentid, c.title as filename, c.pageid, c1.title as pagetitle, concat(CAST( cp.longval as float ) / 1000, 'KB') as filesize, concat('http://your.company.domain/pages/viewpageattachments.action?pageId=', c.pageid) as url from content c join spaces s on c.spaceid = s.spaceid join content c1 on c.pageid = c1.contentid join CONTENTPROPERTIES cp on cp.propertyname='FILESIZE' where c.contenttype = 'ATTACHMENT' and s.spacename = 'spacename' and cp.contentid = c.contentid order by cp.longval desc;
※補足
「contenttype」ページのコンテンツIDはページIDとして利用されたり、対象ページにファイルが添付されると、その添付ファイルは対象ページのページIDをデータとして保持するので下記SQLで「contenttype」がページのデータを呼び出すことができるようです。
join content c1 on c.pageid = c1.contentidコメントを追加...