Reputation: 11725
I have a class User withthe definitions: ID, Name, CustomerID and a class Customer with the definitions: ID, Name, Address
I am trying the following query but I`m having the error message, Incorrect syntax near the keyword 'user'.
What is wrong with the sql?
I am trying to write the sql
"select user.ID, user.Name, Customer.Name from User LEFT JOIN CUSTOMER on User.CustomerID = Customer.ID" using relationsExtension as
return Connection.db.FetchOneToMany<User, Customer>(user =>user.CustomerID,
"select * from user left join customer on customer.ID= user.CustomerID order by user.name asc");
Upvotes: 0
Views: 575
Reputation: 4315
lowercase user is a SQL keyword. Try like this instead:
select [User].ID, [User].Name, Customer.Name from User ...
Upvotes: 1