select d.major_id as majorId,c.grade,
c.course_start_time as courseStartTime,c.course_end_time as courseEndTime,
p.name as projectName,p.semester,d.name as directionName,
c.teacher_name as teacherName,c.total
from course c,project p,direction d
where p.id = c.project_id and d.id = c.direction_id and c.enterprise_id = 6 and c.id = 6
-- 例子 ok
SELECT avg (t1.rowobj -> '$.score') as s
SELECT a.rowobj -> '$.score' -> '$[0][0]'
-- ,t1.r2 -> '$.score' as zx
FROM
(
SELECT answers->'$[0][0]' AS rowobj FROM student_survey_info
-- WHERE student_survey_info.course_id = 1
UNION ALL
SELECT answers->'$[1][0]' AS rowobj FROM student_survey_info
-- WHERE student_survey_info.course_id = 1
UNION ALL
SELECT answers->'$[2][0]' AS rowobj FROM student_survey_info
-- WHERE student_survey_info.course_id = 1
UNION ALL
SELECT answers->'$[3][0]' AS rowobj FROM student_survey_info
-- WHERE student_survey_info.course_id = 1
UNION ALL
SELECT answers->'$[4][0]' AS rowobj FROM student_survey_info
-- WHERE student_survey_info.course_id = 1
UNION ALL
SELECT answers->'$[5][0]' AS rowobj FROM student_survey_info
-- WHERE student_survey_info.course_id = 1
) a
WHERE t1.course_id = 1;
-- 评价分 ok
SELECT avg (ssj.score -> '$.score') as score
FROM
(
SELECT answers->'$[0][0]' AS score FROM student_survey_info
WHERE student_survey_info.course_id = 1
) ssj;
-- 数量
-- ok
SELECT count(*)
FROM
(
SELECT answers->'$[0][0]' AS score FROM student_survey_info
-- WHERE student_survey_info.course_id = 1
) ssj;
json sql语句
最新推荐文章于 2024-06-13 16:43:59 发布