[英]How to match partial strings in one table to ID in another table?
嗯。 . . 你可以這樣做:
select ld.*
from logDetail ld join
documents d
on ld.logDetail like concat('% ID ', d.documentId);
您顯示的所有logDetail
記錄都以' ID <number>'
結尾,因此這與該模式匹配。
如果 id 總是在日志的末尾,您可以在連接條件中使用like
:
select *
from logdetail ld
inner join documents d
on l.logdetail like concat('%', d.documentid)
如果字符串格式是固定的,您甚至可以更精確:
select *
from logdetail ld
inner join documents d
on l.logdetail = concat('Load Shared Document with ID ', d.documentid)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.