 SELECT Community2Item.community_id, ItemsByDateAccessioned.* 
 FROM ItemsByDateAccessioned, Community2Item
 WHERE ItemsByDateAccessioned.item_id = Community2Item.item_id
-ORDER BY DateAccessioned desc, ItemsByDateAccessioned.item_id
-;
-
+;
+

SELECT Community2Item.community_id, ItemsByDate.* 
FROM ItemsByDate, Community2Item
WHERE ItemsByDate.item_id = Community2Item.item_id
ORDER BY DateIssued desc, ItemsByDate.item_id
;

-------------------------------------------------------
--  ItemsByDateAccessioned view
-------------------------------------------------------
DROP VIEW ItemsByDateAccessioned;

CREATE VIEW ItemsByDateAccessioned as
SELECT DCResult.item_id, DCResult.text_value as DateAccessioned
FROM DCResult, DCTypeRegistry
WHERE DCTypeRegistry.element   = 'date' 
AND   DCTypeRegistry.qualifier = 'accessioned'
AND   DCTypeRegistry.dc_type_id = DCResult.dc_type_id
AND   DCResult.in_archive = 't'
ORDER BY DateAccessioned, DCResult.item_id
;

-------------------------------------------------------
--  CollectionItemsByDateAccessioned view

SELECT Collection2Item.collection_id, ItemsByTitle.* 
FROM ItemsByTitle, Collection2Item
WHERE ItemsByTitle.item_id = Collection2Item.item_id
;

-------------------------------------------------------
