首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

求一条查询语句解决方案

2012-09-15 
求一条查询语句PHP code两张表表A:product_iduser_id112212313413表B:product_idowner_id212312413513假设

求一条查询语句

PHP code
两张表表A:product_id   user_id1               122               123               134               13表B:product_id   owner_id2               123               124               135               13假设我要根据user_id=owner_id=12 来查询product_id, 最后要得到的结果是1,2,3,怎么做?


[解决办法]
select product_id from A where user_id=12
union 
select product_id from B where owner_id=12

热点排行