CakePHP 与 MySQL 查询的问题
我有两个表:
客户:id,名称 文本:id、文本
文本表中的字段文本可以包含客户名称。我想为每个文本找到名称包含在文本字段中的客户。例如:
CLIENTS
id | name
1 | John Smith
2 | Mark Jackson
3 | Ann Boo
TEXTS
id | text
1 | John Smith and Ann Boo are my best friends.
2 | I really don't like Mark Jackson and John Smith.
结果应该是:
RESULT
Text.id | Client.id | Client.name
1 | 1 | John Smith
1 | 3 | Ann Boo
2 | 1 | John Smith
2 | 2 | Mark Jackson
我希望你能帮助我:) 我想知道 find() 函数应该有哪些参数或者只是 mysql 查询
I have two tables:
Clients: id, name
Texts: id, text
Field text in Texts table can contain names of clients. I would like to find for each text, clients whose names are contained in text field. For example:
CLIENTS
id | name
1 | John Smith
2 | Mark Jackson
3 | Ann Boo
TEXTS
id | text
1 | John Smith and Ann Boo are my best friends.
2 | I really don't like Mark Jackson and John Smith.
The result should be:
RESULT
Text.id | Client.id | Client.name
1 | 1 | John Smith
1 | 3 | Ann Boo
2 | 1 | John Smith
2 | 2 | Mark Jackson
I hope you will help me :)
I want to know what parameters should find() function have or just mysql query
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)