java这样的查询语句能写吗?
有两个表都有name这个字段,值是不一样的,能一句SQL查询出来吗
select name from table1 where orderID = '123'select name from table2 where age = '35'这两条语句能合成一条吗?如果能合并,怎么在rs里面分辨哪个是表1的结果哪个是表2的结果
SELECT name, 'table1' AS category FROM table1 WHERE ...UNION ALLSELECT name, 'table2' AS category FROM table2 WHERE ...
[解决办法]
select name,'表1' as tempColumn from table1 where orderID = '123'union allselect age,'表2' as tempColumn from table2 where age = '35'