0

Based on the explanation here: How do I join two worksheets in Excel as I would in SQL?

I tried to join two excel sheets from different files into the same sheet. However, I keep getting this error message when I try to refresh the table:

[MICROSOFT][OBDC Excel Driver] Too few parameters. Expected 5.

The SQL queries I've put in so far were:

SELECT `Sheet1$`.ID, `Sheet1$`.Name, `Sheet1$`.`L Name`
FROM `C:\Users\Tom\Book1.xlsx`.`Sheet1$` a
LEFT JOIN `C:\Users\Tom\Book2.xlsx`.`Sheet1$` b
ON a.col2= b.col2

and

SELECT `Sheet1$`.ID, `Sheet1$`.Name, `Sheet1$`.`L Name`
FROM `C:\Users\Tom\Book1.xlsx`.`Sheet1$` a
LEFT JOIN `C:\Users\Tom\Book2.xlsx`.`Sheet1$` b
ON a.`ID`= b.`ID`

and

SELECT *
FROM `C:\Users\Tom\Book1.xlsx`.`Sheet1$` a
LEFT JOIN `C:\Users\Tom\Book2.xlsx`.`Sheet1$` b
ON a.`ID`= b.`ID`

and a few combinations and alterations. I can't seem to find the solution.

I've learned that it definitely doesn't like the SELECT *. But I can't fix it.

Can anyone suggest any solution?

toms
  • 178

1 Answers1

0

supposing that sheet1 = {ID, Name, L Name} and that sheet2 = {ID, R Name}, try that:

SELECT `Sheet1$`.ID, `Sheet1$`.Name, `Sheet1$`.`L Name`, `Sheet2$`.ID, `Sheet2$`.`R Name`
FROM {oj `C:\Users\Tom\Book1.xlsx`.`Sheet1$` `Sheet1$` LEFT OUTER JOIN `C:\Users\Tom\Book2.xlsx`.`Sheet2$` `Sheet2$` ON `Sheet1$`.ID = `Sheet2$`.ID}

the graphic editor helped. you have to drag and drop the fields upon each other and double click the connection to select the join type.