18-07-1394، 08:22 ب.ظ
من یچند تا جدول دارم که میخوام join بزنم و مقداریرو بخونم
یکی از جدولها ممکنه مقداری نداشته باشه و به همین علت کوئری هیچ نتیجه ای بر نمیگردونه
از چجور join باید استفاده کنم که این موضوع رفع بشه
این کوئریمه
[attachment=283]
[attachment=284]
یکی از جدولها ممکنه مقداری نداشته باشه و به همین علت کوئری هیچ نتیجه ای بر نمیگردونه
از چجور join باید استفاده کنم که این موضوع رفع بشه
این کوئریمه
SELECT tpc.id AS tpcId, tpc.user_id AS tpcuser_id, tpc.departman_id AS tpcdepartman_id, tpc.periority_id AS tpcperiority_id, tpc.situation_id AS tpcsituation_id, tpc.file AS tpcfile, tpc.create_date AS tpcreate_date, tpc.title AS tpctitle, tpc.body AS tpcBody, tpc.follow_code AS tpcfollow_code, user.id AS userId, user.fname AS userfname, user.lname AS userlname, dpt.id AS dptId, dpt.title AS dpttitle, prt.id AS prtId, prt.name AS prtname, stu.id AS stuid, stu.title AS stutitle, fac.id AS facId, fac.topic_id AS factopic_id, fac.price AS facPrice fac.status AS facStatus FROM topic tpc LEFT OUTER JOIN users user ON tpc.user_id = user.id LEFT OUTER JOIN ticket_departman dpt ON tpc.departman_id = dpt.id LEFT OUTER JOIN periority prt ON prt.id = tpc.periority_id LEFT OUTER JOIN situation stu ON tpc.situation_id = stu.id LEFT INNER JOIN factor fac ON tpc.id = fac.topic_id WHERE(tpc.id = $topicId AND fac.topic_id = $topicId); ");
[attachment=283]
[attachment=284]