-
Notifications
You must be signed in to change notification settings - Fork 442
Closed as not planned
Labels
Description
2025/2/2
Which SQL and options did you provide as input?
select c.customer_id as cus_id
, c.customer_name123123121231 as cus_name
, c.city as city
, p.phone_number as phone_number
, sum(o.amount) as total_amount
from customers c
cross join addr on addr.id = 1
left join orders o on c.customer_id = o.customer_id
and o.amt is not null
left join (
select customer_id
, phone_number
from cust_phone
) p on c.customer_id = p.customer_id
where o.amount > (
select avg(amount)
from orders
) -- 子查询:过滤出订单金额大于平均值的客户
and c.city = 'SH'
or o.amt >= 1000.00
group by c.customer_id
, c.customer_name
, c.city
;
Expected Output
select c.customer_id as cus_id
,c.customer_name123123121231 as cus_name
,c.city as city
,p.phone_number as phone_number
,sum(o.amount) as total_amount
from customers c
cross join addr
on addr.id = 1
left join orders o
on c.customer_id = o.customer_id
and o.amt is not null
left join (
select customer_id
,phone_number
from cust_phone
) p
on c.customer_id = p.customer_id
where o.amount > (
select avg(amount)
from orders
) -- 子查询:过滤出订单金额大于平均值的客户
and c.city = 'SH'
or o.amt >= 1000.00
group by c.customer_id
,c.customer_name
,c.city
;Usage
- How are you calling / using the library?
VS Code - What SQL language(s) does this apply to?
SQL - Which SQL Formatter version are you using?
1.6
**Issue **
Issue 1: Misalignment in CROSS JOIN. Currently, CROSS is being treated as a keyword for alignment, but CROSS JOIN should be treated as a single keyword.
Issue 2: When selecting "tabularRight", there are excessive spaces between SELECT and the fields, and the reason for this is unclear.