php - MySQL two tables query records with the same field and output a field
phpcn_u1582
phpcn_u1582 2017-06-23 09:11:33
0
3
755


user table


single table

As shown in the figure, how to query the same records of user and user in the single table and output the id of the user table and the exam_name field of the user single table

Or how to change this table to make it better

still have a question

If you want to modify the user in the user table, how can the user corresponding to the single table be modified at the same time? I’m a newbie and I don’t understand very well. I hope my friends can help me and teach me. Thank you

phpcn_u1582
phpcn_u1582

reply all(3)
phpcn_u1582

select a.id,a.user,b.exam_namc from user as a join single as b on a.user = b.user

过去多啦不再A梦

No debugging
1,

select u.id, u.user, s.exam_name from user u, single s where u.user = s.user

2,

update user u,single s  set u.user = '值', s.user = '值' where u.user = u.user and u.id = '条件'
某草草

To join two tables when selecting, you can check the usage of sql join.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template