Home > database >  Mysql query optimization
Mysql query optimization

Time:12-17

Name list sharing_name and shared_name corresponding are info list of phone, 2 tables through the same id connection, phone the column needs to show 2 column
When making query with code:
 select m.p hone, Nancy (polocy) pelosi hone 
The from name
Left the join the info m on the name id=m.i d
Left the join the info n on the name. Id=n.i d

The result is shown in figure, although the result is good, but always feel where not to, this code is good for you to how to optimize the


CodePudding user response:

Choke refers to A calculate, what do you mean by "name list sharing_name and shared_name corresponding is the phone info list", why we feel there is no corresponding relationship ah, aa this say what you mean

CodePudding user response:

By id, A phone is 17012345672

CodePudding user response:

What is the difference between this m.p you hone and Nancy (polocy) pelosi hone, why want to split into two columns
Left the join the info m on the name id=m.i d
Left the join the info n on the name. Id=n.i d
These two words don't mean a

CodePudding user response:

Front page display time needs to have a 2 column, a column is a sharing of the phone, a column is a Shared phone

CodePudding user response:

The
reference
m.p hone as sharing_phone
, Nancy (polocy) pelosi hone as shared_phone
 

CodePudding user response:

But you wrote and
The select m.p hone, m.p hone
The from name
Left the join the info m on name id=m.i d if there is no difference, anyway, the two sentences logically if you are also a meaning

CodePudding user response:

To put it bluntly, just like 1 #, you find the id of the phone seems to be just on the basis of the info list, you say share and sharing field had what effect?
Are not two tables directly on id=id join up, and then the name column of the query results show twice
  • Related