테이블 치과 열이 (제목, 게시자, 키워드, 제목)이고 다른 테이블이 있습니다 (저자, 제목, 저널, 발행인, 요약 , 키워드) 및 세 번째 테이블 현자 열은 (저자, 제목, 저널, 발행인, 요약, 키워드)입니다. 질문은 어떻게 내가 모든 세 테이블에서 데이터베이스에서 데이터를 얻을 수있는 모든 노동 조합을 통해 이러한 테이블을 결합 할 수 있습니다.다른 열이있는 다중 테이블과 결합하는 방법
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'
봐 (HTTP : // 유래 .com/questions/15867152/mysql-union-different-of-columns? rq = 1). 나는 그들의 접근 방식 ("null"값을 겹치지 않는 컬럼에 대해 제안한다.) – Insac
두 테이블 모두 다른 수를 가지고 있기 때문에 –
컬럼의 다른 숫자를 가질 수있다. 그러나 접근법은 일반화 될 수있다 .. 아래에 제안 된 대답을 보라 – Insac