You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While trying all options to solve an issue mentioned in #3706, I tried JSqlParser. It created a count query closer to what it should be—it understands DISTINCT, at least. However, the enhancer created an invalid query.
Original query:
SELECT DISTINCT a.*, b.b1
FROM TableA a
JOIN TableB b ON ...
LEFT JOIN TableC ON ...
WHERE ...
ORDER BY b.b1, a.a1, a.a2
Derived count query:
SELECT count(DISTINCT *)
FROM TableA a
JOIN TableB b ON ...
LEFT JOIN TableC ON ...
WHERE ...
The enhancer complains that The query you provided is not a valid SQL Query and that it Encountered unexpected token: "(" "(" at line 1, column 13. The DB (Postgres) also fails this query because it should say SELECT count(DISTINCT a.*) FROM ....