postgresql7.4
SELECT l.lab_id, l.name AS lab_name, l.instructor_id,
to_char(l.start_date, 'YYYY') AS year
FROM lrc_lab l, lrc_lab_student_map s
WHERE s.lab_id = l.lab_id
AND l.lab_id = :lab_id
AND s.user_id = :author_id
SELECT t.name AS template_name
FROM lrc_template t
WHERE t.template_id = :template_id
SELECT name AS section_name, description AS section_desc
FROM lrc_section
WHERE section_id = :section_id
SELECT name AS resource_name, url AS resource_url
FROM lrc_resource
WHERE section_id = :section_id
SELECT feedback_criteria_id, name AS feedback_criteria_name
FROM lrc_feedback_criteria
WHERE section_id = :section_id
SELECT comment_id, comment
FROM lr_section_comment
WHERE section_id = :section_id
AND report_id = :report_id
AND package_id = :package_id
SELECT section_id AS nav_section_id, name AS nav_section_name
FROM lrc_section
WHERE template_id = :template_id
ORDER BY section_id
SELECT content_id
FROM lr_section_content
WHERE report_id = :report_id
AND section_id = :section_id
AND package_id = :package_id
SELECT content_id, content from lr_section_content
WHERE report_id = :report_id
AND section_id = :section_id
AND package_id = :package_id
SELECT current_timestamp AS now, m.start_date, m.end_date
FROM lrc_lab_template_map m
WHERE m.lab_id = :lab_id
AND m.template_id = :template_id