从2个表中检索具有相似值的字段? [英] Retrieve fields with similar values from 2 tables?

查看:64
本文介绍了从2个表中检索具有相似值的字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hiya,


如何从2个表中检索具有相似值的字段?


我试图使用

(1)SELECT * FROM $ table1 as o,$ table2 as p WHERE o.name like

''%p。name%''" ;;

但它根本没有检索。


(2)" SELECT * FROM $ table1 as o,$ table2 as p WHERE o.name like p.name" ;;

只会检索完全匹配,但这不是我想要的。


(3)SELECT * FROM $ table1 as o,$ table2 as p WHERE o .name LIKE CONCAT(''%'',

p.name,''%'');

只会检索完全匹配。


任何建议都会受到赞赏。


PostScript:我在mysql组中发布了以上内容,但问题仍然存在,所以我是

尝试我的运气好。


TIA

解决方案

table1为o,


< blockquote> table2 as p WHERE o.name like

''%p.name%' ;

但它根本没有检索。


(2)" SELECT * FROM


table1 as o,


Hiya,

How do i retreive fields with similar values from 2 tables?

I tried to use
(1) "SELECT * FROM $table1 as o , $table2 as p WHERE o.name like
''%p.name%''";
but it retrieves nothing at all.

(2) "SELECT * FROM $table1 as o , $table2 as p WHERE o.name like p.name";
will retrieve exact matches only, but this is not what i want.

(3) SELECT * FROM $table1 as o , $table2 as p WHERE o.name LIKE CONCAT(''%'',
p.name, ''%'');
will retrieve exact matches only.

Any advice will be appreciated.

PostScript: i posted the above in mysql groups, but problem remains, so am
trying my luck here.

TIA

解决方案

table1 as o ,


table2 as p WHERE o.name like
''%p.name%''";
but it retrieves nothing at all.

(2) "SELECT * FROM


table1 as o ,


这篇关于从2个表中检索具有相似值的字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆