Skip to content
Advertisement

SQL – Alias, SQL Command not properly ended – Error at line 2 column 23

I’m trying to do a simple left join from two tables(‘asset’,’companies’). For this I decided to use aliases(for the tables) as well, just to practice and improve skills. However I cannot get them to work! I receive a ‘SQL command not properly ended’ error at line:2 column: 23. Which is point of the first alias (‘a’). Please see my code below.

I have already looked at several posts. Indicating that AS is not supported in the from statement, but you can just amit it like I have done. From all the post I have looked at this should work. Also I have checked all spellings.

select a.assetnum, a.description, a.location, a.serialnum, a.modelnum, a.manufacturer, b.name 
from asset a, companies b
left join b on a.manufacturer = b.company
where a.location like 'L0%';

Advertisement

Answer

your join will be like below don’t use coma separated old join

select a.assetnum, a.description, a.location,
 a.serialnum, a.modelnum, a.manufacturer, b.name 
from asset a
left join companies b  on a.manufacturer = b.company
where a.location like 'L0%';

you did mistake from asset a, companies b it will be

from asset a left join companies b  on a.manufacturer = b.company
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement