من یچند تا جدول دارم که میخوام join بزنم و مقداریرو بخونم
یکی از جدولها ممکنه مقداری نداشته باشه و به همین علت کوئری هیچ نتیجه ای بر نمیگردونه
از چجور join باید استفاده کنم که این موضوع رفع بشه
این کوئریمه
یکی از جدولها ممکنه مقداری نداشته باشه و به همین علت کوئری هیچ نتیجه ای بر نمیگردونه
از چجور join باید استفاده کنم که این موضوع رفع بشه
این کوئریمه
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 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); "); |