0
SELECT  d.sbjnum, d.name, d.scan_no, c.scanner  
FROM data AS d  
INNER JOIN check AS c ON d.sbjnum = c.sbjnum  

Database query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'check AS c ON d.sbjnum = c.sbjnum' at line 3

Do not know what I am doing wrong!

Arion
  • 31,011
  • 10
  • 70
  • 88

5 Answers5

1

check is a reserved keyword in MySQL. Put it in ticks to escape it:

SELECT  d.sbjnum, d.name, d.scan_no, c.scanner  
FROM data AS d  
INNER JOIN `check` AS c ON d.sbjnum = c.sbjnum  
John Conde
  • 217,595
  • 99
  • 455
  • 496
0

AS is used for creating an alias for a field, not for a table. For tables, just don't write that AS :)

SELECT  d.sbjnum, d.name, d.scan_no, c.scanner  
FROM data d  
INNER JOIN check c ON d.sbjnum = c.sbjnum  
sp00m
  • 47,968
  • 31
  • 142
  • 252
0

CHECK is a mysql keyword. If u insist on using it, at least put it in backtiks.
And also remove the AS in the FROM part.

Itay Moav -Malimovka
  • 52,579
  • 61
  • 190
  • 278
0

check is a reserved keyword in MySQL.

You can change the alias name

SELECT  d.sbjnum, d.name, d.scan_no, c.scanner  
FROM data AS d  
INNER JOIN check1 AS c ON d.sbjnum = c.sbjnum 

Or Put it in ticks to escape it:

SELECT  d.sbjnum, d.name, d.scan_no, c.scanner  
FROM data AS d  
INNER JOIN `check` AS c ON d.sbjnum = c.sbjnum 
Shaikh Farooque
  • 2,620
  • 1
  • 19
  • 33
-1

You may try to add a semicolon (;) at the end of the request.

If still not working, please consider give us the CREATE TABLE command for these 2 tables.

Olivier G
  • 125
  • 6