comment(/* This is a modified copy of the query linked above to test other keywords: */) class(SELECT) ident(sd)operator(.)ident(qbclass)operator(,) comment(-- Comments Test) predefined(Sum)operator(()ident(sd)operator(.)ident(amount)operator(\)) reserved(AS) ident(invoiceamount)operator(,) comment(# Comments Test) predefined(Sum)operator(()ident(scd1)operator(.)ident(amount)operator(\)) reserved(AS) ident(paymentsperiod1)operator(,) predefined(Sum)operator(()ident(scd2)operator(.)ident(amount)operator(\)) reserved(AS) ident(paymentsperiod2)operator(,) predefined(Sum)operator(()ident(scd3)operator(.)ident(amount)operator(\)) reserved(AS) ident(paymentsperiod3) reserved(FROM) ident(studentdebit) reserved(AS) ident(sd) reserved(LEFT) reserved(JOIN) operator(()class(SELECT) ident(studentcreditdetail)operator(.)ident(studentdebitid)operator(,) ident(studentcreditdetail)operator(.)ident(amount)operator(,) ident(studentcredit)operator(.)pre_type(date)operator(,) ident(credittype)operator(.)ident(credittype) reserved(FROM) ident(studentcreditdetail) reserved(INNER) reserved(JOIN) ident(studentcredit) reserved(ON) ident(studentcreditdetail)operator(.)ident(studentcreditid) operator(=) ident(studentcredit)operator(.)ident(studentcreditid) reserved(AND) ident(studentcredit)operator(.)ident(obsolete) operator(=) integer(0) comment(/* Not Deleted */) reserved(AND) ident(studentcredit)operator(.)ident(status) operator(=) integer(1) comment(/* Successful */) comment(/* PERIOD 1 */) reserved(AND) ident(studentcredit)operator(.)pre_type(date) operator(<) predefined(Now)operator(()operator(\)) comment(/* PERIOD 1 */) reserved(AND) ident(studentcredit)operator(.)pre_type(date) operator(>) predefined(Now)operator(()operator(\)) operator(-) ident(INTERVAL) integer(1) ident(MONTH) reserved(LEFT) reserved(JOIN) ident(credittype) reserved(USING)operator(()ident(credittypeid)operator(\))operator(\)) reserved(AS) ident(scd1) reserved(ON) ident(sd)operator(.)ident(studentdebitid) operator(=) ident(scd1)operator(.)ident(studentdebitid) reserved(LEFT) reserved(JOIN) operator(()class(SELECT) ident(studentcreditdetail)operator(.)ident(studentdebitid)operator(,) ident(studentcreditdetail)operator(.)ident(amount)operator(,) ident(studentcredit)operator(.)pre_type(date)operator(,) ident(credittype)operator(.)ident(credittype) reserved(FROM) ident(studentcreditdetail) reserved(INNER) reserved(JOIN) ident(studentcredit) reserved(ON) ident(studentcreditdetail)operator(.)ident(studentcreditid) operator(=) ident(studentcredit)operator(.)ident(studentcreditid) reserved(AND) ident(studentcredit)operator(.)ident(obsolete) operator(=) integer(0) comment(/* Not Deleted */) reserved(AND) ident(studentcredit)operator(.)ident(status) operator(=) integer(1) comment(/* Successful */) comment(/* PERIOD 2 */) reserved(AND) ident(studentcredit)operator(.)pre_type(date) operator(<) predefined(Now)operator(()operator(\)) operator(-) ident(INTERVAL) integer(1) ident(MONTH) comment(/* PERIOD 2 */) reserved(AND) ident(studentcredit)operator(.)pre_type(date) operator(>) predefined(Now)operator(()operator(\)) operator(-) ident(INTERVAL) integer(2) ident(MONTH) reserved(LEFT) reserved(OUTER) reserved(JOIN) ident(credittype) reserved(USING)operator(()ident(credittypeid)operator(\))operator(\)) reserved(AS) ident(scd2) reserved(ON) ident(sd)operator(.)ident(studentdebitid) operator(=) ident(scd2)operator(.)ident(studentdebitid) reserved(RIGHT) reserved(JOIN) operator(()class(SELECT) ident(studentcreditdetail)operator(.)ident(studentdebitid)operator(,) ident(studentcreditdetail)operator(.)ident(amount)operator(,) ident(studentcredit)operator(.)pre_type(date)operator(,) ident(credittype)operator(.)ident(credittype) reserved(FROM) ident(studentcreditdetail) reserved(INNER) reserved(JOIN) ident(studentcredit) reserved(ON) ident(studentcreditdetail)operator(.)ident(studentcreditid) operator(=) ident(studentcredit)operator(.)ident(studentcreditid) reserved(AND) ident(studentcredit)operator(.)ident(obsolete) operator(=) integer(0) comment(/* Not Deleted */) reserved(AND) ident(studentcredit)operator(.)ident(status) operator(=) integer(1) comment(/* Successful */) comment(/* PERIOD 3 */) reserved(AND) ident(studentcredit)operator(.)pre_type(date) operator(<) predefined(Now)operator(()operator(\)) operator(-) ident(INTERVAL) integer(2) ident(MONTH) comment(/* PERIOD 3 */) reserved(AND) ident(studentcredit)operator(.)pre_type(date) operator(>) predefined(Now)operator(()operator(\)) operator(-) ident(INTERVAL) integer(3) ident(MONTH) reserved(LEFT) reserved(JOIN) ident(credittype) reserved(USING)operator(()ident(credittypeid)operator(\))operator(\)) reserved(AS) ident(scd3) reserved(ON) ident(sd)operator(.)ident(studentdebitid) operator(=) ident(scd3)operator(.)ident(studentdebitid) reserved(WHERE) ident(sd)operator(.)ident(obsolete) operator(=) integer(0) comment(/* Not Deleted */) reserved(AND) ident(sd)operator(.)ident(status) operator(=) integer(0) comment(/* Normal */) comment(/* Exclude Voided Invoices */) reserved(AND) ident(sd)operator(.)ident(adjustsdebitid) reserved(IS) pre_constant(NULL) reserved(AND) ident(sd)operator(.)ident(studentdebitid) reserved(NOT) ident(IN) operator(()class(SELECT) ident(adjustsdebitid) reserved(FROM) ident(studentdebit) reserved(WHERE) ident(adjustsdebitid) reserved(IS) reserved(NOT) pre_constant(NULL)operator(\)) comment(/* FULL PERIOD */) reserved(AND) ident(sd)operator(.)pre_type(DATE) operator(<) predefined(Now)operator(()operator(\)) comment(/* FULL PERIOD */) reserved(AND) ident(sd)operator(.)pre_type(DATE) operator(>) predefined(Now)operator(()operator(\)) operator(-) ident(INTERVAL) integer(3) ident(MONTH) reserved(GROUP) reserved(BY) ident(sd)operator(.)ident(qbclass) comment(/* Formatting only */) reserved(UNION) reserved(ALL) class(SELECT) stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,) string comment(/* Payment Types Summary */) reserved(UNION) reserved(DISTINCT) class(SELECT) ident(credittype)operator(,) ident(invoiceamount)operator(,) predefined(Sum)operator(()ident(paymentsperiod1)operator(\))operator(,) predefined(Sum)operator(()ident(paymentsperiod2)operator(\))operator(,) predefined(Sum)operator(()ident(paymentsperiod3)operator(\)) reserved(FROM) operator(()class(SELECT) ident(scd)operator(.)ident(credittype)operator(,) string reserved(AS) ident(invoiceamount)operator(,) predefined(Sum)operator(()ident(scd)operator(.)ident(amount)operator(\)) reserved(AS) ident(paymentsperiod1)operator(,) string reserved(AS) ident(paymentsperiod2)operator(,) string reserved(AS) ident(paymentsperiod3) reserved(FROM) ident(studentdebit) reserved(AS) ident(sd) reserved(INNER) reserved(JOIN) operator(()class(SELECT) ident(studentcreditdetail)operator(.)ident(studentdebitid)operator(,) ident(studentcreditdetail)operator(.)ident(amount)operator(,) ident(studentcredit)operator(.)pre_type(date)operator(,) ident(credittype)operator(.)ident(credittype) reserved(FROM) ident(studentcreditdetail) reserved(INNER) reserved(JOIN) ident(studentcredit) reserved(ON) ident(studentcreditdetail)operator(.)ident(studentcreditid) operator(=) ident(studentcredit)operator(.)ident(studentcreditid) reserved(AND) ident(studentcredit)operator(.)ident(obsolete) operator(=) integer(0) comment(/* Not Deleted */) reserved(AND) ident(studentcredit)operator(.)ident(status) operator(=) integer(1) comment(/* Successful */) comment(/* PERIOD 1 */) reserved(AND) ident(studentcredit)operator(.)pre_type(date) operator(<) predefined(Now)operator(()operator(\)) comment(/* PERIOD 1 */) reserved(AND) ident(studentcredit)operator(.)pre_type(date) operator(>) predefined(Now)operator(()operator(\)) operator(-) ident(INTERVAL) integer(1) ident(MONTH) reserved(LEFT) reserved(JOIN) ident(credittype) reserved(USING)operator(()ident(credittypeid)operator(\))operator(\)) reserved(AS) ident(scd) reserved(ON) ident(sd)operator(.)ident(studentdebitid) operator(=) ident(scd)operator(.)ident(studentdebitid) reserved(WHERE) ident(sd)operator(.)ident(obsolete) operator(=) integer(0) comment(/* Not Deleted */) reserved(AND) ident(sd)operator(.)ident(status) operator(=) integer(0) comment(/* Normal */) comment(/* Exclude Voided Invoices */) reserved(AND) ident(sd)operator(.)ident(adjustsdebitid) reserved(IS) pre_constant(NULL) reserved(AND) ident(sd)operator(.)ident(studentdebitid) reserved(NOT) ident(IN) operator(()class(SELECT) ident(adjustsdebitid) reserved(FROM) ident(studentdebit) reserved(WHERE) ident(adjustsdebitid) reserved(IS) reserved(NOT) pre_constant(NULL)operator(\)) reserved(AND) ident(sd)operator(.)pre_type(DATE) operator(<) predefined(Now)operator(()operator(\)) reserved(AND) ident(sd)operator(.)pre_type(DATE) operator(>) predefined(Now)operator(()operator(\)) operator(-) ident(INTERVAL) integer(3) ident(MONTH) reserved(GROUP) reserved(BY) ident(scd)operator(.)ident(credittype) reserved(UNION) reserved(ALL) class(SELECT) ident(scd)operator(.)ident(credittype)operator(,) string reserved(AS) ident(invoiceamount)operator(,) string reserved(AS) ident(paymentsperiod1)operator(,) predefined(Sum)operator(()ident(scd)operator(.)ident(amount)operator(\)) reserved(AS) ident(paymentsperiod2)operator(,) string reserved(AS) ident(paymentsperiod3) reserved(FROM) ident(studentdebit) reserved(AS) ident(sd) reserved(INNER) reserved(JOIN) operator(()class(SELECT) ident(studentcreditdetail)operator(.)ident(studentdebitid)operator(,) ident(studentcreditdetail)operator(.)ident(amount)operator(,) ident(studentcredit)operator(.)pre_type(date)operator(,) ident(credittype)operator(.)ident(credittype) reserved(FROM) ident(studentcreditdetail) reserved(INNER) reserved(JOIN) ident(studentcredit) reserved(ON) ident(studentcreditdetail)operator(.)ident(studentcreditid) operator(=) ident(studentcredit)operator(.)ident(studentcreditid) reserved(AND) ident(studentcredit)operator(.)ident(obsolete) operator(=) integer(0) comment(/* Not Deleted */) reserved(AND) ident(studentcredit)operator(.)ident(status) operator(=) integer(1) comment(/* Successful */) comment(/* PERIOD 2 */) reserved(AND) ident(studentcredit)operator(.)pre_type(date) operator(<) predefined(Now)operator(()operator(\)) operator(-) ident(INTERVAL) integer(1) ident(MONTH) comment(/* PERIOD 2 */) reserved(AND) ident(studentcredit)operator(.)pre_type(date) operator(>) predefined(Now)operator(()operator(\)) operator(-) ident(INTERVAL) integer(2) ident(MONTH) reserved(LEFT) reserved(JOIN) ident(credittype) reserved(USING)operator(()ident(credittypeid)operator(\))operator(\)) reserved(AS) ident(scd) reserved(ON) ident(sd)operator(.)ident(studentdebitid) operator(=) ident(scd)operator(.)ident(studentdebitid) reserved(WHERE) ident(sd)operator(.)ident(obsolete) operator(=) integer(0) comment(/* Not Deleted */) reserved(AND) ident(sd)operator(.)ident(status) operator(=) integer(0) comment(/* Normal */) comment(/* Exclude Voided Invoices */) reserved(AND) ident(sd)operator(.)ident(adjustsdebitid) reserved(IS) pre_constant(NULL) reserved(AND) ident(sd)operator(.)ident(studentdebitid) reserved(NOT) ident(IN) operator(()class(SELECT) ident(adjustsdebitid) reserved(FROM) ident(studentdebit) reserved(WHERE) ident(adjustsdebitid) reserved(IS) reserved(NOT) pre_constant(NULL)operator(\)) reserved(AND) ident(sd)operator(.)pre_type(DATE) operator(<) predefined(Now)operator(()operator(\)) reserved(AND) ident(sd)operator(.)pre_type(DATE) operator(>) predefined(Now)operator(()operator(\)) operator(-) ident(INTERVAL) integer(3) ident(MONTH) reserved(GROUP) reserved(BY) ident(scd)operator(.)ident(credittype) reserved(UNION) reserved(ALL) class(SELECT) ident(scd)operator(.)ident(credittype)operator(,) string reserved(AS) ident(invoiceamount)operator(,) string reserved(AS) ident(paymentsperiod1)operator(,) string reserved(AS) ident(paymentsperiod2)operator(,) predefined(Sum)operator(()ident(scd)operator(.)ident(amount)operator(\)) reserved(AS) ident(paymentsperiod3) reserved(FROM) ident(studentdebit) reserved(AS) ident(sd) reserved(INNER) reserved(JOIN) operator(()class(SELECT) ident(studentcreditdetail)operator(.)ident(studentdebitid)operator(,) ident(studentcreditdetail)operator(.)ident(amount)operator(,) ident(studentcredit)operator(.)pre_type(date)operator(,) ident(credittype)operator(.)ident(credittype) reserved(FROM) ident(studentcreditdetail) reserved(INNER) reserved(JOIN) ident(studentcredit) reserved(ON) ident(studentcreditdetail)operator(.)ident(studentcreditid) operator(=) ident(studentcredit)operator(.)ident(studentcreditid) reserved(AND) ident(studentcredit)operator(.)ident(obsolete) operator(=) integer(0) comment(/* Not Deleted */) reserved(AND) ident(studentcredit)operator(.)ident(status) operator(=) integer(1) comment(/* Successful */) comment(/* PERIOD 3 */) reserved(AND) ident(studentcredit)operator(.)pre_type(date) operator(<) predefined(Now)operator(()operator(\)) operator(-) ident(INTERVAL) integer(2) ident(MONTH) comment(/* PERIOD 3 */) reserved(AND) ident(studentcredit)operator(.)pre_type(date) operator(>) predefined(Now)operator(()operator(\)) operator(-) ident(INTERVAL) integer(3) ident(MONTH) reserved(LEFT) reserved(JOIN) ident(credittype) reserved(USING)operator(()ident(credittypeid)operator(\))operator(\)) reserved(AS) ident(scd) reserved(ON) ident(sd)operator(.)ident(studentdebitid) operator(=) ident(scd)operator(.)ident(studentdebitid) reserved(WHERE) ident(sd)operator(.)ident(obsolete) operator(=) integer(0) comment(/* Not Deleted */) reserved(AND) ident(sd)operator(.)ident(status) operator(=) integer(0) comment(/* Normal */) comment(/* Exclude Voided Invoices */) reserved(AND) ident(sd)operator(.)ident(adjustsdebitid) reserved(IS) pre_constant(NULL) reserved(AND) ident(sd)operator(.)ident(studentdebitid) reserved(NOT) ident(IN) operator(()class(SELECT) ident(adjustsdebitid) reserved(FROM) ident(studentdebit) reserved(WHERE) ident(adjustsdebitid) reserved(IS) reserved(NOT) pre_constant(NULL)operator(\)) reserved(AND) ident(sd)operator(.)pre_type(date) operator(<) predefined(Now)operator(()operator(\)) reserved(AND) ident(sd)operator(.)pre_type(date) operator(>) predefined(Now)operator(()operator(\)) operator(-) ident(INTERVAL) integer(3) ident(MONTH) reserved(GROUP) reserved(BY) ident(scd)operator(.)ident(credittype)operator(\)) reserved(AS) ident(ct) reserved(GROUP) reserved(BY) ident(ct)operator(.)ident(credittype) class(SELECT) string reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) stringoperator(,) reserved(If)operator(()operator(()stringoperator(.)string reserved(IS) reserved(NOT) pre_constant(NULL)operator(\))operator(,)stringoperator(.)stringoperator(,) stringoperator(.)stringoperator(\)) reserved(AS) stringoperator(,) string reserved(AS) string reserved(FROM) operator(()operator(()operator(()operator(()operator(()operator(()operator(()operator(()string string reserved(JOIN) string string reserved(ON) operator(()operator(()operator(()stringoperator(.)string operator(=) stringoperator(.)stringoperator(\)) reserved(AND) operator(()stringoperator(.)string operator(=) stringoperator(\)) reserved(AND) operator(()operator(()stringoperator(.)string operator(<) predefined(Now)operator(()operator(\))operator(\)) reserved(OR) ident(Isnull)operator(()stringoperator(.)stringoperator(\))operator(\))operator(\))operator(\))operator(\)) reserved(LEFT) reserved(JOIN) string string reserved(ON) operator(()operator(()stringoperator(.)string operator(=) stringoperator(.)stringoperator(\))operator(\))operator(\)) reserved(LEFT) reserved(JOIN) string string reserved(ON) operator(()operator(()stringoperator(.)string operator(=) stringoperator(.)stringoperator(\))operator(\))operator(\)) reserved(LEFT) reserved(JOIN) string string reserved(ON) operator(()operator(()operator(()stringoperator(.)string operator(=) stringoperator(.)stringoperator(\)) reserved(AND) operator(()stringoperator(.)string operator(=) stringoperator(\))operator(\))operator(\))operator(\)) reserved(LEFT) reserved(JOIN) string string reserved(ON) operator(()operator(()stringoperator(.)string operator(=) stringoperator(.)stringoperator(\))operator(\))operator(\)) reserved(LEFT) reserved(JOIN) string string reserved(ON) operator(()operator(()stringoperator(.)string operator(=) stringoperator(.)stringoperator(\))operator(\))operator(\)) reserved(LEFT) reserved(JOIN) string string reserved(ON) operator(()operator(()stringoperator(.)string operator(=) stringoperator(.)stringoperator(\))operator(\))operator(\)) reserved(LEFT) reserved(JOIN) string string reserved(ON) operator(()operator(()stringoperator(.)string operator(=) stringoperator(.)stringoperator(\))operator(\))operator(\)) reserved(UNION) class(SELECT) string reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) stringoperator(,) reserved(If)operator(()operator(()stringoperator(.)string reserved(IS) reserved(NOT) pre_constant(NULL)operator(\))operator(,)stringoperator(.)stringoperator(,) stringoperator(.)stringoperator(\)) reserved(AS) stringoperator(,) stringoperator(.)string reserved(AS) string reserved(FROM) operator(()operator(()operator(()operator(()operator(()operator(()operator(()operator(()string string reserved(JOIN) string string reserved(ON) operator(()operator(()stringoperator(.)string operator(=) stringoperator(.)stringoperator(\))operator(\))operator(\)) reserved(LEFT) reserved(JOIN) string string reserved(ON) operator(()operator(()stringoperator(.)string operator(=) stringoperator(.)stringoperator(\))operator(\))operator(\)) reserved(LEFT) reserved(JOIN) string string reserved(ON) operator(()operator(()stringoperator(.)string operator(=) stringoperator(.)stringoperator(\))operator(\))operator(\)) reserved(LEFT) reserved(JOIN) string string reserved(ON) operator(()operator(()stringoperator(.)string operator(=) stringoperator(.)stringoperator(\))operator(\))operator(\)) reserved(LEFT) reserved(JOIN) string string reserved(ON) operator(()operator(()stringoperator(.)string operator(=) stringoperator(.)stringoperator(\))operator(\))operator(\)) reserved(LEFT) reserved(JOIN) string string reserved(ON) operator(()operator(()stringoperator(.)string operator(=) stringoperator(.)stringoperator(\))operator(\))operator(\)) reserved(LEFT) reserved(JOIN) string string reserved(ON) operator(()operator(()stringoperator(.)string operator(=) stringoperator(.)stringoperator(\))operator(\))operator(\)) reserved(LEFT) reserved(JOIN) string string reserved(ON) operator(()operator(()stringoperator(.)string operator(=) stringoperator(.)stringoperator(\))operator(\))operator(\)) reserved(WHERE) operator(()reserved(NOT) operator(()operator(()stringoperator(.)string reserved(LIKE) stringoperator(\))operator(\))operator(\))