Multi-table contact relationship call

Source: Internet
Author: User
Multi-table join call table & nbsp; business_circle field & nbsp; id & nbsp; name & nbsp; parent_id & nbsp; table & nbsp; goods_area field & nbsp; goods_id & nbsp; city & nbsp; area & nbsp; multi-table join call
Table business_circle
Field id name parent_id

Table goods_area
Goods_id city area


$ SQL = mysql_query ("select * from goods_area as a inner join business_circle as B on a. area = B. name order by a. goods_id asc ");
While ($ rs = mysql_fetch_assoc ($ SQL )){
Echo $ rs ['region']. $ rs ['parent _ id'].'
';
}




In this way, you can call the value of parent_id, but I want to call the name value in the condition parent_id = id table business_circle.

Do you know how to make it clear? The master directly gave the complete code. thanks for sharing the following:
------ Solution --------------------
At least I don't understand. can I paste the table before running and the result table after running?
------ Solution --------------------
I don't know if you want this select * from goods_area as a inner join business_circle as B on a. area = B. name where a. parent_id = B. id order by a. goods_id asc
------ Solution --------------------
"This can call the value of parent_id, but I want to call the name value in the condition parent_id = id table business_circle"
This sentence cannot be understood.
------ Solution --------------------
I still don't understand. can I directly paste the desired result into a table?

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.