摘要:
在error中遍历出来的异常 很难见 阅读全文
摘要:
BEGIN SET @userId = (SELECT user_id FROM t_shoporder WHERE id = orderId); /*修改订单状态,改成已支付*/ UPDATE t_shoporder SET `status` = 1,update_time = NOW() WHERE id = orderId; /*查询用户是否已经学习改课程*... 阅读全文
摘要:
BEGIN DECLARE smark INT; DECLARE orderId INT; /*查询课程是否存在,如果不存在就不执行订单操作了*/ SET @count = (SELECT count(1) FROM t_course WHERE id = courseId); IF @count = 0 THEN SELECT "no... 阅读全文
摘要:
课程表,订单表(统计报名人数),评论表(统计评论的人数),点赞表(点赞人数)利用sql是最精准的做法 SELECT tc.id, tc.title, tc.img, (SELECT COUNT(1) FROM t_shoporder WHERE course_id = tc.id) AS order 阅读全文