There are two tables, Table 1 ->T1:
id name time type
1 A hh 1
2 B kk 1
3 c vv 2
Table 2- > T2:
id pid every
1 1 20
2 1 10
3 1 5
4 2 15
5 2 10
6 3 25
7 3 35
The pid of table 2 is associated with the id of table 1, when type=1 , hoping to get the following two pieces of data:
1 A hh 20 10 5 (35)
2 B kk 15 10 (25)
Please tell me how to write the sql statement, thank you! PS: The thinkPHP framework is used