I have 2 tables :
tb_doc :
===========================================
| id | document_title | document_summary |
===========================================
| 1 | a data mining | document_summary1 |
| 2 | B | document_summary2 |
===========================================
tb_wrap :
============================================
| id | data_url | data_title | doc_url |
===========================================
| 1 |data_url1 | B | doc_url1 |
| 2 |data_url2 | a data mining | doc_url2 |
============================================
I wanna join data from 2 table where document_title = data_title (match 2 strings), so I will get the result like :
data_title <href data_url>
doc_url
document_summary
here’s the query :
SELECT * from tb_wrap as a
JOIN (
SELECT document_title, document_summary from tb_doc) as b`
ON a.data_title LIKE b.document_title
How to get them? thank you 🙂
The
JOINcondition should be an=rather than aLIKE. I see no need to join against a subquery. This is just a rudimentaryINNER JOIN.