around this issue I am trying to do a LEFT JOIN (in mysql/php) with two tables to create JSON Table for use with Google line chart. But for some reason, the sql is not populating data in the json table although when I test the same sql directly in phpadmin I am getting the right output. , When you have a query like
This might help you You could change the MAX(g.moment) to IF(a.status<>1, NULL, MAX(g.moment)) or alternately change LEFT JOIN geodata AS g ON g.entityID = e.id to LEFT JOIN geodata AS g ON a.entityID = e.id AND a.status = 1
Full Outer Join (left join union right join) MySQL multiple tables
around this issue Just have a look at Below query, Hope this may help you! Later you can Modify Accordingly This will join to all 5 tables. Here I kept Location as the Left Table so that All locations will be Displaying after firing this query and matching Id's will be matched to this table.
SELECT * FROM location LEFT JOIN location_type ON location_type.type_id=location.loc_id
LEFT JOIN hours ON location.loc_id=hours.loc_id
LEFT JOIN holiday ON holiday.loc_id=location.loc_id
LEFT JOIN holiday_hours ON holiday.hol_id=holiday_hours.holiday_id
around this issue There are two joins missing I found, I have made the correction in SQL. Try it, hope you will get expected result.
INNER JOIN class
ON teach.classid = class.classid
INNER JOIN student
ON teach.studentid = student.studentid
INNER JOIN quiz
ON quiz.classid = tech.classid
LEFT JOIN quizscore
ON (teach.studentid = quizscore.studentid
and quiz.quizid = quizscore.quizid)
teach.classid = quiz.classid AND
quiz.quizid = '1' and
quiz.classid = '1'
ORDER BY studentid ASC
MySql LEFT JOIN returns wrong first in PHP page, but correct results in MYSQL command line