求一条查询语句
- 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