hiddentao / squel

:office: SQL query string builder for Javascript
https://hiddentao.github.io/squel
MIT License
1.57k stars 231 forks source link

Incorrect syntax near '`'. #374

Open AlexanderTunick opened 5 years ago

AlexanderTunick commented 5 years ago

Hi, can't figure out why I can't make a simple query.

let a = squel.select({ separator: '\n' })
            .from("dbo.Person", "p")
            .field("count(distinct p.personId)")
            .left_join("dbo.OrganizationDetail", "od", "od.OrganizationUniqueID = p.OrganizationUniqueID")
            .toString()

Output:

SELECT
count(distinct p.personId)
FROM dbo.Person `p`
LEFT JOIN dbo.OrganizationDetail `od` ON (od.OrganizationUniqueID = p.OrganizationUniqueID)

Error: RequestError: Incorrect syntax near '`'.

I see that the problem is under '`' sign, but why it formed like this? Could I somehow avoid these cross quotes?