JSqlParser icon indicating copy to clipboard operation
JSqlParser copied to clipboard

net.sf.jsqlparser.JSQLParserException: Encountered unexpected token: "desc" "DESC"

Open zhaochengbei opened this issue 4 years ago • 2 comments

Describe the bug parser error.

To Reproduce Steps to reproduce the behavior:

  1. Example SQL : select a from b group by c desc;
  2. Parsing this SQL using JSqlParser with this statements
  3. Exception : JSQLParserException

Expected behavior parser success.

System

  • mysql 5.7
  • Java 1.8
  • JSqlParser 4.0

zhaochengbei avatar Apr 20 '21 10:04 zhaochengbei

I have never seen such a construct. Is group by c desc a shortcut for group by c order by c desc?

wumpz avatar Apr 28 '21 10:04 wumpz

This is an old way of writing. This SQL can be run on MySQL.

zhaochengbei avatar Apr 29 '21 12:04 zhaochengbei