Help me check SQL problems

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.