SELECT & nbsp; ornamentation_images.ismark & nbsp; ismark, ornamentation_images.width & nbsp; width, ornamentation_images.height & nbsp; height, users. nickname & nbsp; name, ornamentations help me with an SQL question
SELECT ornamentation_images.ismark ismark,ornamentation_images.width width,ornamentation_images.height height,users.nickname name,ornamentations.id id,ornamentations.image_name image_name,ornamentations.image_url image_url,ornamentations.add_author add_author,ornamentations.browse_real_cnt browse_real_cnt,ornamentations.comnum comnum,users.head head,users.comnum unreadFROM `ornamentation_images`
LEFT JOIN users on ornamentation_images.add_author=users.id
LEFT JOIN ornamentations on ornamentation_images.ornamentation_id=ornamentations.id
WHERE ( ornamentations.enable = 0 ) AND ( ornamentations.checkstatus = 2 )
ORDER BY ornamentations.id desc LIMIT 0,5
The results can be found, but the data in the users table is not found. what is the problem?
------ Solution ----------------------
Where is the table structure?
------ Solution ----------------------
This may be caused by left join.
Left join is based on records in the left Table. ornamentation_images can be viewed as the left table, users can be viewed as the right table, and left join is based on the left table.
In other words, all records in the left table are displayed, while only records meeting the search conditions are displayed in the right table. all records in the right table are NULL.
The landlord can check whether this is the reason.