我想在quiz.test.program_id中显示最后更新的值。如果删除SELECT draft_business_program.program_name, draft_business_program.draft_program_id,
draft_business_program.description, category_master.category_name
FROM draft_business_program
LEFT JOIN category_master ON draft_business_program.catgory_id = category_master.category_id
LEFT JOIN `draft_program_recurrence` ON draft_business_program.draft_program_id =draft_program_recurrence.draft_program_id
LEFT JOIN quiz_test ON quiz_test.program_id = draft_business_program.draft_program_id
LEFT JOIN quizmaster ON quiz_test.quiz_id = quizmaster.quiz_id
LEFT JOIN quiz_result_summary ON quiz_test.id = quiz_result_summary.quiz_test_id
LEFT JOIN business_certificates ON quiz_test.business_id = business_certificates.business_id
WHERE quiz_test.quiz_status = 1
AND quiz_test.user_id= 962
AND quiz_test.business_id= 146
ORDER BY quiz_test.program_id DESC
LIMIT 1
,怎么可能?它显示了所有值,但我需要显示的是上次更新的值。
请给我建议。
CREATE OR REPLACE FUNCTION func(a integer)
RETURNS integer AS
$BODY$
begin
for row in
Select id from table_a where quantity=1
loop
do something
end loop
end;
$BODY$
LANGUAGE plpgsql VOLATILE