SQL query statistics, based on news category ID statistics, no data is displayed 0

Source: Internet
Author: User
There are two tables: MessageInfo and MessageType. The table structure is as follows: Then we need to implement the following query results: This is what I encountered during the interview, and the above news type is gibberish. I didn't do it at the time, and then I came back and studied it again. At the beginning, the news type table MessageType left connected to leftjoin new

There are two tables: MessageInfo and MessageType. The table structure is as follows: Then we need to implement the following query results: This is what I encountered during the interview, and the above news type is gibberish. I didn't do it at the time, and then I came back and studied it again. At the beginning, the news type table MessageType left join new

There are two tables: MessageInfo and MessageType. The table structure is as follows:

Then you need to implement the following query results:

This is what I met during the interview. The above news types are gibberish. I didn't do it at the time. I went back to study the website space.

In the beginning, the website space and news type table MessageType are left connected to the left join news information table MessageInfo. If the news ID is empty, the news type names are directly grouped for statistics.

, MessageType left join MessageInfoMessageName, website Space

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.