-- -- -- the middle table
,
professional table
Now I have such a query, enter the school name, according to the professional table to match spname field proname to the middle of the table?
Select *
The from mybatis. School s,
Mybatis. Profession p
Mybatis. Gaokao g
Where s.s cid=g.s cid
And g.s pname=p.p roname
And s.n ame='Beijing university'
Difficulty is, for example a clause in the middle table spname "economics class (economics, finance, international economy and trade, insurance, risk management and insurance), finance, resource and environmental economics)" data, how to look for in the professional table to economics, finance, international economy and trade, such as the professional? That is how to modify the above my query, I hope you can be glad,
CodePudding user response:
Select *The from mybatis. School s,
Mybatis. Profession p
Mybatis. Gaokao g
Where s.s cid=g.s cid
And g.s pname like concat (" % ", p.p roname, "%")
And s.n ame='Beijing university'