SQL formatting. Subquery in the same line as JION word.
已回答
How can I force IDE to put "(SELECT..." in the same line as "JOIN"? It works well with subquery and "FROM"-word, it works well with table_name and "FROM"-word, but it works not in a correct way with subquery (or table name) and "JOIN"-word. Example (sorry, looks like spaces at the beginning of lines are cropped in this forum form, but it's not important) :
-- before
SELECT *
FROM
(SELECT t1.col_a, t1.col_b
FROM table_t1 t3) t1
JOIN
table_t2 t2 ON t2.col_a = t1.col_a
JOIN
(SELECT t3.col_a, t3.col_b
FROM table_t3 t3) tt ON t3.col_a = tt.col_a;
Ctrl + Alt + L
-- after
SELECT *
FROM (SELECT t1.col_a, t1.col_b
FROM table_t1 t3) t1
JOIN
table_t2 t2 ON t2.col_a = t1.col_a
JOIN
(SELECT t3.col_a, t3.col_b
FROM table_t3 t3) tt ON t3.col_a = tt.col_a;
So the question is how to force IDE to put subqueries and table names after JOIN in the same line? Sorry for silly question, but it annoys me a little bit.
请先登录再写评论。
Try the following code style settings for the General SQL dialect:
They give me this code style in the editor:
Thanks a lot Arina, it really helped! I should have turned off keeping line breaks.