我有一个类User,其定义为:ID,Name,CustomerID 以及具有定义的类Customer:ID,Name,Address
我正在尝试以下查询,但我收到错误消息,关键字'user'附近的语法不正确。
sql出了什么问题?
我正在尝试编写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");
答案 0 :(得分:1)
小写用户是SQL关键字。请尝试这样:
从用户中选择 [用户] .ID, [用户] .Name,Customer.Name