DROP PROCEDURE IF EXISTS gdc_GetAllEntries; DELIMITER $$ create procedure gdc_GetAllEntries (_collectionID int) READS SQL DATA SQL SECURITY INVOKER begin select e.EntryID, EntryDate, UserID, Credits, QuestionID, TextCopy, IntCopy, DateCopy from gdc_Entry e, gdc_EntryData ed where e.EntryID = ed.EntryID and e.EntryID = any ( select EntryID from gdc_Entry where CollectionID = _collectionID ) order by e.EntryID, QuestionID, Rank; end; $$