结合我有一个表牙科 列是(标题,出版社,关键词,主题)和另一 表,我有爱思唯尔 列是(作者,标题,期刊,出版社,抽象,关键字 和第三表圣人 列是(作者,标题,期刊,出版商,摘要,关键字)。 问题是我怎样才能将这些表通过union组合起来,以便我可以从所有三个表中的数据库中获取数据。 我不能使用只能加入我有工会所以建议如果,如果有对此联盟与多台不同的列如何
当我使用任何解决方案选项:
select null author, Title, null journal, publisher, subject as abstract, keyword from table1
union
select author, title, journal, publisher, abstract,keyword from table2
select null author,Title,null journal,publisher,null abstract,subject as abstract,keyword from dental
where (Author LIKE '%Bastone%' or Title LIKE '%Bastone%' or Journal LIKE '%Bastone%'
or Publisher LIKE '%Bastone%' or abstracts LIKE '%Bastone%' or Keyword LIKE '%Bastone%'
or Title LIKE '%Bastone%' or Publisher LIKE '%Bastone%' or Keyword LIKE '%Bastone%'
or Subject LIKE '%Bastone%')
union
select author, title, journal, publisher, abstract,keyword, null subject from elsevier
where(Author LIKE '%Bastone%' or Title LIKE '%Bastone%' or Journal LIKE '%Bastone%'
or Publisher LIKE '%Bastone%' or abstracts LIKE '%Bastone%' or Keyword LIKE '%Bastone%'
or Title LIKE '%Bastone%' or Publisher LIKE '%Bastone%' or Keyword LIKE '%Bastone%'
or Subject LIKE '%Bastone%')
收到此错误
#1054 - Unknown column 'Author' in 'where clause'
看答案就[ “MySQL的工会不同的列数”(HTTP://计算器的.com /问题/ 15867152/RQ的MySQL工会-不同-数的柱α= 1)。我建议他们的方法(“空”值不重叠列) – Insac
没有得到适当的参考值cos这两个表有不同的列数 –
但是,这种方法可以推广..看看我的建议答案 – Insac