How can I solve this problem by finding a PHP and MYSQL join query statement?

Source: Internet
Author: User
Evaluate PHP and MYSQL join query statement Article table: ID, ClassID, TitleClass table: ClassID, when ClassName is required to query the Article table, select from the Class table based on the value of ClassID like the select statement in MSSQL.
Article table: ID, ClassID, Title
Class table: ClassID, ClassName
When querying the Article table, you must retrieve the ClassName from the Class table based on the ClassID value.
Like select (select classname from table_ B where classid = table_a.classid) in MSSQL, * from table_a
I don't know how to query in MYSQL. please help me!

------ Solution --------------------
SQL code
Selete Article. ClassID, Class. ClassID, Class. ClassName as AClassName from rticle, Class where Article. ClassID = Class. ClassID
------ Solution --------------------
SQL code
Select Article. ID Class. ClassName Article. Title from Article inner join Class on (Article. ClassID = Class. ClassID)

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.