0

我不知道我的问题是否存在解决方案。

我正在尝试重新组合来自两个类似查询的结果,而不使用 mySQL 之外的任何其他内容。

这是我的要求:

SELECT id, type as objet, decret as type, resume as synthese FROM projets
SELECT id, type as objet, decret as type, resume as synthese FROM articles

显然,如果我尝试,我会得到一个模棱两可的错误

SELECT id, type as objet, decret as type, resume as synthese FROM articles, projets

我想合并这些结果,以便将其导出到单个 CSV 文件中,而不使用 Excel 操作等。

谢谢

4

1 回答 1

2

尝试联合

SELECT id, type as objet, decret as type, resume as synthese FROM projets
UNION
SELECT id, type as objet, decret as type, resume as synthese FROM articles

http://dev.mysql.com/doc/refman/5.0/en/union.html

假设两个表中的列相同。

于 2013-03-15T13:41:49.240 回答