0

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");
4

1 回答 1

1

小写用户是 SQL 关键字。试试这样:

从用户中选择[用户] .ID、[用户] .Name、Customer.Name ...

于 2012-03-26T13:18:05.903 回答