如何从数据库中选择数据,但不同的类别和不同的数据

时间:2015-09-06 16:27:45

标签: php mysql

如何从数据库中选择数据但不同的类别和不同的数据

示例数据选择:

sql =“select * from newspaper”;

sql =“select * from vegetable”;

如何从表格同一页面中选择数据

谢谢

2 个答案:

答案 0 :(得分:1)

如果相应列的数据类型相同,则可以使用union从多个表/视图进行查询。例如。 :

select title, manu_V, manu_C, manu_D, yer_manu, offr_oe from table_1 [where clause] **union** cont_num, email, catgy, tit, cat_grup, Estae_catagry from table2 [where clause]

答案 1 :(得分:0)

您只需执行两个查询并从您获得的两个数组中输出数据。